phantom-secrets
CLAUDE.md16 starsChanged 3 months agoMITView on GitHub
Note: ~/.cargo/bin/ prefix is needed because cargo is not in PATH on this machine. Modular Rust workspace with a shipped secret-protection product and separate fail-closed governed-execution foundations: The proxy is a reverse proxy with URL rewriting, NOT a forward/CONNECT proxy. This avoids MITM/CA certificate issues: dotenv.rs::looks_like_secret() uses heuristics to distinguish secrets from config: - Key patterns: *_KEY, *_SECRET*, *_TOKEN, *_PASSWORD, DATABASE_URL, etc. - Value patterns: sk-*, ghp_*, connection strings with @, high-entropy long strings - Non-secrets left untouched: NODE_ENV, PORT,…
- Reads credentials
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
All code must pass cargo clippy -- -D warnings and cargo fmt --check
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Phantom — Development Guide
Quick Reference
# Build
~/.cargo/bin/cargo build
# Test
~/.cargo/bin/cargo test
# Lint (must pass with zero warnings)
~/.cargo/bin/cargo clippy --all-targets -- -D warnings
# Format
~/.cargo/bin/cargo fmt --all
# Run CLI
~/.cargo/bin/cargo run -- <command>Note: ~/.cargo/bin/ prefix is needed because cargo is not in PATH on this machine.
Architecture
Modular Rust workspace with a shipped secret-protection product and separate fail-closed governed-execution foundations:
- phantom-core — Config (.phantom.toml), .env parsing/rewriting, phantom token generation (256-bit CSPRNG,
phm_prefix), error types - phantom-vault —
VaultBackendtrait with OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) and encrypted file fallback. Argon2id parameters hardened to OWASP balanced (m=64 MiB, t=3, p=1) with legacy-default fallback for older vaults - phantom-proxy — HTTP reverse proxy on 127.0.0.1. It authenticates and matches exact routes, discards client control of the route auth header, injects only the route-owned vault value there, and forwards client bodies byte-for-byte under a hard size cap. Client headers/bodies never resolve
phm_tokens. Useshyperfor server andreqwestfor outbound HTTPS; response streaming/SSE is preserved through scrubbing. - phantom-cli —
clap-based CLI for init, proxy execution, diagnostics, sync, teams, audit, validation, provider design foundations, and trusted-terminal workspace setup. Live provider issuance/rotation is hard-denied before credential/network access in 0.7.9. Usephantom --helpas the canonical command inventory. Plaintext JSON export is disabled; reveal requires an attached terminal and exact typed confirmation. - phantom-mcp — MCP server for Claude Code, Cursor, Windsurf, Codex. Uses
rmcp3.5 SDK and stdio transport. Exposes core vault/diagnostic/cloud/team tools plus advanced audit, validation, rotation, expiry, leak-incident, and compliance workflows. The exact catalog is declared incrates/phantom-mcp/src/server.rs. - governed-execution foundations —
phantom-workspaceprovides the active value-blind Unix setup transaction.phantom-authority,phantom-locus-contract,phantom-broker,phantom-runtime,phantom-session, andphantom-evidenceremain fail closed for production execution.
How the proxy works
The proxy is a reverse proxy with URL rewriting, NOT a forward/CONNECT proxy. This avoids MITM/CA certificate issues:
phantom execsetsOPENAI_BASE_URL=http://127.0.0.1:PORT/openai(and similar for other services)- API client code sends HTTP to localhost proxy instead of real HTTPS endpoint
- Proxy authenticates and matches an exact route, then injects the route-owned vault value only into its fixed auth header; client headers/bodies remain unresolved
- Proxy forwards modified request over TLS to real endpoint (e.g.,
api.openai.com)
Secret detection
dotenv.rs::looks_like_secret() uses heuristics to distinguish secrets from config:
- Key patterns:
*_KEY,*_SECRET*,*_TOKEN,*_PASSWORD,DATABASE_URL, etc. - Value patterns:
sk-*,ghp_*, connection strings with@, high-entropy long strings - Non-secrets left untouched:
NODE_ENV,PORT,DEBUG, etc.
Conventions
- All code must pass
cargo clippy -- -D warningsandcargo fmt --check - Tests go in
#[cfg(test)] mod testswithin source files, not separate test files - Integration tests for proxy use
test_server.rs(mock HTTP server that records requests) - Error handling:
thiserrorfor library crates,anyhowfor CLI - CLI output uses
coloredcrate — prefix lines with->,ok,!,warn, etc. - Secrets must be
zeroized from memory after use - Proxy binds to 127.0.0.1 ONLY — never expose to network
- Audit log is opt-in:
PHANTOM_AUDIT=1writes JSONL events for vault store/retrieve/delete to~/.phantom/audit.log. Schema records the secret name only — never the value. Each entry carries an HMAC-SHA256 over the previous entry's hash (chain rooted at a zero-hash). New audit hook points should callphantom_core::audit::log(op, name). Usephantom audit verifyto check chain integrity. - Importers live in
phantom-core/src/importers/. Each format (doppler, infisical, dotenvx, 1password, env) implements a parser that returnsBTreeMap<String, String>. The CLI dispatcher isphantom_core::importers::import_from(source, path).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

