{"slug": "show-hn-redacted-stop-handing-claude-your-secrets", "title": "Show HN: Redacted - Stop Handing Claude Your Secrets", "summary": "A developer released Redacted, an open-source tool that scrubs secrets from tool output before an AI coding assistant reads it, distributed via a curl install script, Homebrew, Cargo and pre-built binaries for Linux, macOS and Windows. Redacted runs as a Claude Code PostToolUse hook, scanning locally with no network calls, and ships 46 built-in vendor patterns covering AWS, GitHub, Stripe, OpenAI, Anthropic, database URLs and private keys, plus a `redacted init` command that learns values from .env files by storing only a SHA-256 hash, length and optional shape. The tool matters because secrets persist in the on-disk transcript and every later request once they enter context, and its documented limits include whole-token-only matching for learned secrets, possible false positives on high-entropy identifiers when the entropy heuristic is enabled, and unscrubbed output from commands typed with `!` at the Claude Code prompt.", "body_md": "Removes secrets from tool output before your AI coding assistant reads it.\n\nTool output:\n\n```\nDATABASE_URL=postgres://admin:secret@db.example.com:5432/prod\nAWS_ACCESS_KEY_ID=AKIAEXAMPLEKEYID0001\nSMTP_PASS=\"Qf7mZp2kLw9vTx4nRb2024\"\nAPP_NAME=myapp\n```\n\nWhat the model reads (the third line needs `SMTP_PASS` learned by `redacted init`):\n\n```\nDATABASE_URL=[REDACTED:database_url ...prod]\nAWS_ACCESS_KEY_ID=[REDACTED:aws_access_key ...0001]\nSMTP_PASS=\"[REDACTED:smtp_pass ...2024]\"\nAPP_NAME=myapp\n```\n\nSecrets reach the model through normal work, not only through `cat .env`:\n\n- Ordinary output carries them: a committed key in `git diff` , a token in a log, a stack trace that prints the environment.\n- Some commands exist to print them: `heroku config` ,`kubectl get secret -o yaml` ,`aws secretsmanager get-secret-value` .\n- Deny lists check the command string. An npm script, a make target or a wrapper CLI changes the string, not the output.\n- Once in context, a secret stays in the transcript on disk and in every later request.\n\n`redacted` does not judge commands. It scrubs the output, whatever produced it.\n\n- Runs as a Claude Code PostToolUse hook: `redacted scrub` reads each tool result on stdin.\n- Scanning happens on your machine. No network calls.\n- A secret is replaced inline by a marker that keeps its last 4 characters.\n- Clean output passes through unchanged.\n\n```\ncurl -sSL https://raw.githubusercontent.com/svn-arv/redacted/main/install.sh | sh\nredacted init\n```\n\nHomebrew, Cargo and pre-built binaries for Linux, macOS and Windows are in the [reference](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#install).\n\n- Learns the secrets in your `.env` files, so the hook catches them even when no vendor pattern knows their format.\n- Stores a SHA-256 hash, the length and an optional shape for each value. Never the value.\n- You pick the values to learn and confirm the config before anything is written.\n- Registers the hook in your Claude Code settings. Safe to run again.\n\nFull walkthrough and flags: [Setup: `redacted init`](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#setup-redacted-init).\n\n| Tier | What it catches | Default | \n|---|---|---|\n| Vendor signatures | Keys with a known format: 46 built-in patterns covering AWS, GitHub, Stripe, OpenAI, Anthropic, database URLs, private keys and more. | on | \n| Learned secrets | The values `redacted init` learned from your`.env` , matched by hash, plus rotated keys with the same prefix. | on once `init` writes entries | \n| Entropy heuristic | Random-looking values in `KEY=value` lines that no other tier knows. | off | \n\nEmail addresses and phone numbers can be scrubbed too. Each is off until you turn it on in the config.\n\nEvery pattern and what it matches: [What it detects](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#what-it-detects).\n\n- Claude Code, through the PostToolUse hook.\n- OpenCode, through the plugin that `redacted init --format opencode` writes.\n\nOther assistants, and whether their hooks can replace tool output, are listed under [Other tools](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md#other-tools).\n\n- Learned secrets match as whole tokens. One embedded mid-token, such as in a URL path, passes unless a vendor pattern catches it.\n- A learned shape also matches a non-secret with the same prefix and similar length. Check the shape `init` shows before confirming.\n- With the heuristic on, a high-entropy identifier that mixes case and digits (some tool or request ids) may be redacted. The 4-character hint makes these easy to spot.\n- Every pattern scans the full output in turn, after a substring prefilter. Multi-megabyte output adds noticeable latency per call.\n- Commands typed at the Claude Code prompt with `!` are not tool calls. Their output reaches the model unscrubbed.\n\n- [Reference](https://github.com/svn-arv/redacted/blob/main/docs/REFERENCE.md) : install methods,`init` , every pattern, configuration and commands.\n- [Architecture](https://github.com/svn-arv/redacted/blob/main/docs/ARCHITECTURE.md) : how the code fits together.\n- [Benchmark](https://github.com/svn-arv/redacted/blob/main/docs/BENCHMARK.md) : recall and precision on the test corpus.\n- [Contributing](https://github.com/svn-arv/redacted/blob/main/CONTRIBUTING.md) : development, adding a detection rule and releasing.\n\nMIT", "url": "https://wpnews.pro/news/show-hn-redacted-stop-handing-claude-your-secrets", "canonical_source": "https://github.com/svn-arv/redacted/", "published_at": "2026-11-16 02:29:03+00:00", "updated_at": "2026-11-16 02:52:16.634816+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "ai-safety"], "entities": ["Redacted", "Claude Code", "OpenCode", "Anthropic", "AWS", "GitHub", "Stripe", "OpenAI"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-redacted-stop-handing-claude-your-secrets", "markdown": "https://wpnews.pro/news/show-hn-redacted-stop-handing-claude-your-secrets.md", "text": "https://wpnews.pro/news/show-hn-redacted-stop-handing-claude-your-secrets.txt", "jsonld": "https://wpnews.pro/news/show-hn-redacted-stop-handing-claude-your-secrets.jsonld"}}