{"slug": "show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs", "title": "Show HN: Leaktap, find and scrub secrets in Claude/Codex/MCP logs", "summary": "A developer released leaktap 0.4.3, an open-source tool that scans local AI coding agent logs, SQLite state files, MCP configs and plugins for leaked secrets and can wrap live Claude Code, Codex CLI, Antigravity CLI and local MCP server sessions to block or redact secrets before they leave the machine. An audit of the top 20 MCP servers on GitHub using leaktap found 5 opened outbound internet connections on startup before any tool ran, 7 ship telemetry on by default, 2 put API keys in CLI flags visible in `ps aux`, and 0 of 470 live tools contained hidden prompt injections. The tool runs offline by default, exits 0 unless `--ci` is passed, and is installable via npx, Homebrew, Cargo or a shell installer.", "body_md": "Find and scrub leaked secrets in local AI coding logs, SQLite state, MCP configs, and plugins, or wrap live CLI and MCP sessions to stop secrets from leaving your machine.\n\nUse Gitleaks or TruffleHog for your git history. Use `leaktap` for everything git never sees: local agent transcripts (`~/.claude`, `~/.codex`, `~/.cursor`, `~/.gemini`), SQLite `-wal` files, `.mcp.json` configs, installed hooks, and live agent traffic.\n\nLive wrapping supports Claude Code (`claude`), Codex CLI (` codex`), Antigravity CLI (` agy`), and local MCP servers. Offline `scan` also checks configs and state left by Cursor, Windsurf, Cline, Roo Code, Zed, Continue, Aider, and similar editors.\n\nI also used `leaktap` to check the [top 20 MCP servers on GitHub](https://github.com/vssinghh/leaktap/blob/master/docs/mcp-top-20-audit.md): 5 opened outbound internet connections on startup before any tool ran, 7 ship telemetry on by default, 2 put API keys in CLI flags visible in `ps aux`, and 0 of 470 live tools had hidden prompt injections.\n\n```\n# Try an offline scan on macOS, Linux, or Windows (0 network requests)\nnpx leaktap@0.4.3\n\n# Or install with Homebrew on macOS / Linux\nbrew install vssinghh/tap/leaktap && leaktap\n```\n\n`npx` (prebuilt native binaries published with npm provenance):\n\n```\nnpx leaktap@0.4.3\n```\n\nHomebrew (macOS and Linux):\n\n```\nbrew install vssinghh/tap/leaktap\n```\n\nCargo:\n\n```\ncargo install --git https://github.com/vssinghh/leaktap --tag v0.4.3 --locked\n```\n\nShell installer (macOS and Linux; inspect the script first):\n\n```\ncurl -fsSLO https://raw.githubusercontent.com/vssinghh/leaktap/v0.4.3/install.sh\nless install.sh\nLEAKTAP_VERSION=v0.4.3 sh install.sh\n\n# Optional: verify GitHub Actions build attestation\ngh attestation verify ~/.local/bin/leaktap --repo vssinghh/leaktap\n```\n\nPrebuilt binaries, `.sha256` checksums, and build attestations for macOS, Linux, and Windows are on [GitHub Releases](https://github.com/vssinghh/leaktap/releases).\n\nRuns offline by default. Scans `~/.claude`, `~/.codex`, `~/.gemini`, `~/.cursor`, `~/.codeium/windsurf`, `~/.continue`, installed plugins and skills, shell hooks, and workspace MCP or rule files.\n\nCatches API keys, private keys (PEM, OpenPGP, JWK, GCP service accounts, Kubernetes secrets), database URLs, and passwords, including encoded blobs (Base64, gzip+Base64, hex, UTF-16) and SQLite `-wal` pages.\n\n```\n# Default local audit (exits 0; add --ci to fail on HIGH/CRITICAL findings)\nleaktap\n\n# Scan both the current repo and global AI agent folders\nleaktap scan --all --ci\n\n# Opt-in: check whether detected keys are still active across 24 providers\nleaktap scan --verify --fail-on critical\n\n# Opt-in: inspect live MCP servers for poisoned tool descriptions and save schema hashes\nleaktap --mcp-pins-file ./mcp-pins.lock scan --inspect-mcp --ci\n\n# Refresh saved MCP tool hashes after upgrading a server\nleaktap --mcp-pins-file ./mcp-pins.lock scan --inspect-mcp --update-mcp-pins\n\n# Scan a specific repo, skill folder, or file\nleaktap scan ./my-project --ci\nleaktap scan ./third-party-skill --ci\n\n# PR CI check loading policy from origin/main with SARIF output\nLEAKTAP_FINGERPRINT_SALT=\"$SARIF_SALT\" leaktap scan . --policy-git-ref origin/main --format sarif --ci > leaktap.sarif\n```\n\n`--inspect-mcp` blocks loopback, private, and cloud-metadata IPs and does not expand `${ENV}` variables from untrusted repo configs.\n\nStart `claude`, `codex`, or `agy` through `leaktap`. Any extra flags pass straight through:\n\n```\n# Watch outgoing prompts, strip unrelated shell secrets, and log child sockets\nleaktap claude\nleaktap codex\nleaktap agy\n\n# Also strip SSH_AUTH_SOCK from the CLI and its MCP servers\nleaktap --scrub-ssh-agent claude\n\n# Keep specific env vars needed by a tool or MCP server\nleaktap --allow-env GH_TOKEN,GOOGLE_APPLICATION_CREDENTIALS claude\n\n# Block outgoing API requests (HTTP 400) containing secrets or critical prompt injections\nleaktap --block-secrets claude\n\n# Redact secrets to [REDACTED_BY_LEAKTAP] in transit (blocks with HTTP 400 if unredactable)\nleaktap --redact-secrets claude\n```\n\nWhen wrapping a session, `leaktap`:\n\n- Strips unrelated shell secrets (`AWS_SECRET_ACCESS_KEY` ,`STRIPE_SECRET_KEY` ,`DATABASE_URL` , etc.) while keeping profile selectors (`AWS_PROFILE` ,`KUBECONFIG` ), the CLI's own API key, and anything passed to`--allow-env` .\n- Routes supported `*_BASE_URL` env vars through a local loopback proxy so prompts, headers, and MCP tool results are checked in memory before forwarding upstream over HTTPS.\n- Inspects non-TTY MCP `tools/list` and`tools/call` traffic for poisoned schemas or rug-pulls, logs`HTTP CONNECT` destination hostnames without custom root certificates, and writes live events to`~/.leaktap/live.jsonl` (`0600` ).\n\nTo wrap a single MCP server inside `.mcp.json`:\n\n```\nleaktap tap --scrub-env --scrub-ssh-agent --quiet --log ~/.leaktap/mcp.jsonl -- npx @org/some-mcp@1.2.0\n```\n\nDry run by default. On a folder, `clean` only edits AI session logs and skips source code and backups unless you pass `--include-code` or point directly at a file.\n\nWith `--apply`, it scrubs text logs, prompt history in `~/.claude.json` (leaving login accounts and `mcpServers` untouched), and SQLite/`-wal` databases after checking for active locks so open IDEs are not corrupted.\n\n```\n# Preview changes without modifying files\nleaktap clean\n\n# Scrub leaked secrets in place\nleaktap clean --apply\n\n# Clean a specific file, or include repo source files\nleaktap clean ./leaked.env --apply\nleaktap clean ./my-repo --include-code --apply\n\n# Save a 0600 <file>.leaktap.bak copy before editing\nleaktap clean --apply --backup\nleaktap ui\n```\n\nOpens a 4-tab view (`Transcript Leaks`, `MCP / Plugin Risks`, `Live Wiretap`, and `Context & PII`). Press `/` to filter, `c` then `y` to scrub just the selected secret across local logs and SQLite files, or `q` / `Ctrl+C` to exit.\n\n`leaktap` loads `~/.config/leaktap/config.toml` automatically. In CI, pass `--config path/to/policy.toml` or `--policy-git-ref origin/main` so a PR branch cannot weaken its own policy.\n\nFor test keys in source or config files, add `# leaktap:ignore` on the same line (or `// leaktap:ignore[rule-id]`, `/* leaktap:ignore */`, `<!-- leaktap:ignore -->`, or `# leaktap:ignore-next-line`). Inline ignores are disabled under `--policy-git-ref` and `--no-inline-ignore`, never apply to chat logs or SQLite stores, and never silence MCP or hook alerts.\n\n## Example `.leaktap.toml` allowlist and custom rule\n\n```\n# Optional secret salt for `[fp:...]` IDs and SARIF fingerprints\n# (prefer setting LEAKTAP_FINGERPRINT_SALT in CI secrets rather than committing it):\n# fingerprint_salt = \"org-random-secret-salt\"\n\n[allowlist]\npaths = [\"tests/fixtures/**\"]\nrules = [\"internal-hostname\"]\nstopwords = [\"acme-sandbox-dummy\"]\n# Copy any 16-char `[fp:...]` ID from terminal, TUI, JSON, or SARIF output:\nfingerprints = [\"9f86d081884c7d65\"]\n\n[allowlist.rule_paths]\n# Allow a specific rule on specific files without hiding leaked keys in those files:\nmcp-unpinned-package = [\"docs/examples/**\"]\n\n[[rules]]\nid = \"acme-prod-token\"\nname = \"Acme Internal Prod Token\"\ndescription = \"Internal Acme production service token (acme_live_...).\"\nseverity = \"critical\"\ncategory = \"secret\"\nanchors = [\"acme_live_\"]\npattern = 'acme_live_[A-Za-z0-9]{24,64}'\nmin_entropy = 3.2\nleaktap rules\nleaktap rules --format json\n```\n\n- `leaktap` runs in user space without`sudo` , custom root certificates, or eBPF hooks so it works out of the box on macOS and Linux. Third-party HTTPS traffic from child tools is logged by`HTTP CONNECT` hostname or OS socket polling (`15ms` on Linux,`500ms` on macOS), without decrypting TLS payloads.\n- A hostile binary that ignores `*_BASE_URL` and`HTTPS_PROXY` , uses gRPC or QUIC, finishes a request faster than the poll interval, or sends raw UDP/DNS can bypass user-space checks. Run untrusted code in`bubblewrap` ,`landlock` ,`sandbox-exec` , or a VM/container.\n- PII checks only cover developer emails and internal hostnames, not SSNs, payment cards, or medical records.\n- `leaktap clean --apply` only removes secrets from local disk. Rotate any key that was already sent to an API or pushed to git.\n- Repo `.leaktap.toml` and`.leaktapignore` files are ignored by default so a cloned repo cannot hide its own findings. Pass`--trust-project-config` or`--policy-git-ref` to load them.\n- SARIF output omits unsalted hashes on email and hostname findings unless `LEAKTAP_FINGERPRINT_SALT` or`fingerprint_salt` is set.\n\n- `leaktap scan` and`leaktap clean` make zero network requests by default. Live checks only run when`--verify` or`--inspect-mcp` is passed.\n- Zero telemetry, analytics, or accounts.\n- Matched secrets are masked (`sk_live_9f...4c21` ) in terminal, UI, JSON, SARIF, and`~/.leaktap/live.jsonl` output.", "url": "https://wpnews.pro/news/show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs", "canonical_source": "https://github.com/vssinghh/leaktap", "published_at": "2026-12-01 16:35:00+00:00", "updated_at": "2026-12-01 16:48:08.084569+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "ai-safety", "developer-tools"], "entities": ["leaktap", "Claude Code", "Codex CLI", "Antigravity CLI", "Cursor", "Windsurf", "Cline", "GitHub"], "also_reported_by": [], "takeaway": "leaktap 0.4.3 scans ~/.claude, ~/.codex, ~/.cursor and other agent state plus SQLite -wal files for secrets, and its --block-secrets wrapper returns HTTP 400 on outgoing requests containing secrets or critical prompt injections.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs", "markdown": "https://wpnews.pro/news/show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs.md", "text": "https://wpnews.pro/news/show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs.txt", "jsonld": "https://wpnews.pro/news/show-hn-leaktap-find-and-scrub-secrets-in-claude-codex-mcp-logs.jsonld"}}