# Show HN: Leaktap, find and scrub secrets in Claude/Codex/MCP logs

> Source: <https://github.com/vssinghh/leaktap>
> Published: 2026-12-01 16:35:00+00:00

**Key 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.

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.

Use 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.

Live 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.

I 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.

```
# Try an offline scan on macOS, Linux, or Windows (0 network requests)
npx leaktap@0.4.3

# Or install with Homebrew on macOS / Linux
brew install vssinghh/tap/leaktap && leaktap
```

`npx` (prebuilt native binaries published with npm provenance):

```
npx leaktap@0.4.3
```

Homebrew (macOS and Linux):

```
brew install vssinghh/tap/leaktap
```

Cargo:

```
cargo install --git https://github.com/vssinghh/leaktap --tag v0.4.3 --locked
```

Shell installer (macOS and Linux; inspect the script first):

```
curl -fsSLO https://raw.githubusercontent.com/vssinghh/leaktap/v0.4.3/install.sh
less install.sh
LEAKTAP_VERSION=v0.4.3 sh install.sh

# Optional: verify GitHub Actions build attestation
gh attestation verify ~/.local/bin/leaktap --repo vssinghh/leaktap
```

Prebuilt binaries, `.sha256` checksums, and build attestations for macOS, Linux, and Windows are on [GitHub Releases](https://github.com/vssinghh/leaktap/releases).

Runs offline by default. Scans `~/.claude`, `~/.codex`, `~/.gemini`, `~/.cursor`, `~/.codeium/windsurf`, `~/.continue`, installed plugins and skills, shell hooks, and workspace MCP or rule files.

Catches 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.

```
# Default local audit (exits 0; add --ci to fail on HIGH/CRITICAL findings)
leaktap

# Scan both the current repo and global AI agent folders
leaktap scan --all --ci

# Opt-in: check whether detected keys are still active across 24 providers
leaktap scan --verify --fail-on critical

# Opt-in: inspect live MCP servers for poisoned tool descriptions and save schema hashes
leaktap --mcp-pins-file ./mcp-pins.lock scan --inspect-mcp --ci

# Refresh saved MCP tool hashes after upgrading a server
leaktap --mcp-pins-file ./mcp-pins.lock scan --inspect-mcp --update-mcp-pins

# Scan a specific repo, skill folder, or file
leaktap scan ./my-project --ci
leaktap scan ./third-party-skill --ci

# PR CI check loading policy from origin/main with SARIF output
LEAKTAP_FINGERPRINT_SALT="$SARIF_SALT" leaktap scan . --policy-git-ref origin/main --format sarif --ci > leaktap.sarif
```

`--inspect-mcp` blocks loopback, private, and cloud-metadata IPs and does not expand `${ENV}` variables from untrusted repo configs.

Start `claude`, `codex`, or `agy` through `leaktap`. Any extra flags pass straight through:

```
# Watch outgoing prompts, strip unrelated shell secrets, and log child sockets
leaktap claude
leaktap codex
leaktap agy

# Also strip SSH_AUTH_SOCK from the CLI and its MCP servers
leaktap --scrub-ssh-agent claude

# Keep specific env vars needed by a tool or MCP server
leaktap --allow-env GH_TOKEN,GOOGLE_APPLICATION_CREDENTIALS claude

# Block outgoing API requests (HTTP 400) containing secrets or critical prompt injections
leaktap --block-secrets claude

# Redact secrets to [REDACTED_BY_LEAKTAP] in transit (blocks with HTTP 400 if unredactable)
leaktap --redact-secrets claude
```

When wrapping a session, `leaktap`:

- 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` .
- 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.
- 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` ).

To wrap a single MCP server inside `.mcp.json`:

```
leaktap tap --scrub-env --scrub-ssh-agent --quiet --log ~/.leaktap/mcp.jsonl -- npx @org/some-mcp@1.2.0
```

Dry 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.

With `--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.

```
# Preview changes without modifying files
leaktap clean

# Scrub leaked secrets in place
leaktap clean --apply

# Clean a specific file, or include repo source files
leaktap clean ./leaked.env --apply
leaktap clean ./my-repo --include-code --apply

# Save a 0600 <file>.leaktap.bak copy before editing
leaktap clean --apply --backup
leaktap ui
```

Opens 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.

`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.

For 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.

## Example `.leaktap.toml` allowlist and custom rule

```
# Optional secret salt for `[fp:...]` IDs and SARIF fingerprints
# (prefer setting LEAKTAP_FINGERPRINT_SALT in CI secrets rather than committing it):
# fingerprint_salt = "org-random-secret-salt"

[allowlist]
paths = ["tests/fixtures/**"]
rules = ["internal-hostname"]
stopwords = ["acme-sandbox-dummy"]
# Copy any 16-char `[fp:...]` ID from terminal, TUI, JSON, or SARIF output:
fingerprints = ["9f86d081884c7d65"]

[allowlist.rule_paths]
# Allow a specific rule on specific files without hiding leaked keys in those files:
mcp-unpinned-package = ["docs/examples/**"]

[[rules]]
id = "acme-prod-token"
name = "Acme Internal Prod Token"
description = "Internal Acme production service token (acme_live_...)."
severity = "critical"
category = "secret"
anchors = ["acme_live_"]
pattern = 'acme_live_[A-Za-z0-9]{24,64}'
min_entropy = 3.2
leaktap rules
leaktap rules --format json
```

- `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.
- 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.
- PII checks only cover developer emails and internal hostnames, not SSNs, payment cards, or medical records.
- `leaktap clean --apply` only removes secrets from local disk. Rotate any key that was already sent to an API or pushed to git.
- 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.
- SARIF output omits unsalted hashes on email and hostname findings unless `LEAKTAP_FINGERPRINT_SALT` or`fingerprint_salt` is set.

- `leaktap scan` and`leaktap clean` make zero network requests by default. Live checks only run when`--verify` or`--inspect-mcp` is passed.
- Zero telemetry, analytics, or accounts.
- Matched secrets are masked (`sk_live_9f...4c21` ) in terminal, UI, JSON, SARIF, and`~/.leaktap/live.jsonl` output.
