{"slug": "your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today", "title": "Your Claude Code approvals can hold your API keys. Check your repo today", "summary": "Researchers at Apiiro found over 100,000 Claude Code local settings files uploaded to public GitHub repos, with about 1,100 from 63 organizations containing secrets such as API tokens, database passwords and private keys, according to an Ars Technica report. A developer demonstrated that approving a Bash command with \"don't ask again\" saves the rule to .claude/settings.local.json, which can capture tokens, and that 215 of the exposed secrets were missed by gitleaks and TruffleHog. The writeup offers a five-minute audit using git ls-files, git log and gitleaks, plus remediation steps to untrack the file and add it to .gitignore.", "body_md": "You have clicked \"Yes, and don't ask again\" in Claude Code more times than you can count. Me too. It feels like a tiny productivity win.\n\nHere is what happens next. Per the [Claude Code permissions docs](https://code.claude.com/docs/en/permissions), when you pick that option on something like a Bash command, Claude Code saves the rule to `.claude/settings.local.json` at the root of your git repository. If the command you approved had a token in it, the rule can have the token too.\n\nThat is not a theory. [Ars Technica reported on Nov 9, 2026](https://arstechnica.com/ai/2026/11/claude-code-settings-files-expose-thousands-of-secrets-on-github/) that researchers at Apiiro found over 100,000 Claude Code local settings files uploaded to public GitHub repos. Only about 1,100, from 63 organizations, held secrets such as API tokens, database passwords and private keys. Small share, real damage. And 215 of those secrets were not flagged by two popular scanners, gitleaks and TruffleHog.\n\nPer the same report, a Claude Code team member said these files should pretty much never be checked into git, and that the team was looking into improvements. Behavior may have changed since, so check your version. In the meantime, here is a five-minute check you can run today.\n\nIn each repo where you use Claude Code:\n\n```\ngit ls-files .claude/settings.local.json\n```\n\nIf it prints the path, git is tracking it. No output is what you want. Then check history, because a file you deleted last month can still be in old commits:\n\n```\ngit log --all --oneline -- .claude/settings.local.json\n```\n\nScan the file with [gitleaks](https://github.com/gitleaks/gitleaks). The `--redact` flag keeps the secret itself out of your terminal output:\n\n```\ngitleaks dir --redact -v .claude\ngitleaks git --redact -v .\n```\n\nThe first scans the folder as it is now. The second scans every commit.\n\nI tested this on a throwaway repo where I committed a fake GitHub-style token inside an approved `curl` command. gitleaks flagged it as `github-pat` in `.claude/settings.local.json` on line 1. That is the happy path. The Apiiro numbers above are why you should not stop here. Scanners know patterns, and 215 secrets slipped past two of them.\n\nSo also read the file yourself. Open it and look at every `Bash(...)` rule for anything that looks like a key, a password or a URL with credentials in it. It is usually short.\n\nPoint this at the folder where you keep code:\n\n```\nfind ~/code -path '*/.claude/settings.local.json' -not -path '*/node_modules/*' 2>/dev/null |\nwhile read -r f; do\n  repo=$(git -C \"$(dirname \"$f\")\" rev-parse --show-toplevel 2>/dev/null) || continue\n  if git -C \"$repo\" log --all --oneline -- .claude/settings.local.json | grep -q .; then\n    echo \"IN HISTORY  $repo\"\n  fi\ndone\n```\n\nEvery line it prints is a repo where that file is, or once was, in git. Repos it does not list are fine on this check.\n\n```\ngit rm --cached .claude/settings.local.json\necho '.claude/settings.local.json' >> .gitignore\ngit add .gitignore\ngit commit -m \"Stop tracking local Claude Code settings\"\n```\n\n`/permissions`.\nClaude Code's own docs add one more reason to keep the file out of git: if `.claude/settings.local.json` is tracked, it is treated as repository-supplied instead of your own, and its rules are held until you trust the folder. A tracked file is not how it is meant to be used.\n\nIf the thing that leaked was a **wallet private key or seed phrase**, moving funds comes before anything else, and the rotation advice above does not apply, because a key cannot be rotated the way an API token can. If you hold crypto and want the scam side covered too, the free [Don't Get Drained guide](https://paxtechservices.gumroad.com/l/dont-get-drained?utm_source=devto&utm_medium=article&utm_campaign=claude-approvals-secrets) is a short read on spotting fake support DMs and claim links.\n\n`curl -H \"Authorization: Bearer $API_TOKEN\" ...` and keep the value in your environment. Since the command text is what gets saved, the rule then holds the variable name, not the token.`Read(./.env)` deny rule, plus patterns like `Read(./secrets/**)`. They are also clear that these rules are not a complete block, for example they do not stop a script that opens files itself. For a hard limit, turn on the `.pre-commit-config.yaml`, then run `pre-commit install`:\n\n```\nrepos:\n  - repo: https://github.com/gitleaks/gitleaks\n    rev: v8.24.2\n    hooks:\n      - id: gitleaks\n```\n\nRun `pre-commit autoupdate` to bump that version. You can also use `gitleaks git --staged --redact .` as a manual check.\n\n| Control | Helps with | Does not help with | \n|---|---|---|\n| `.gitignore` for the file | Accidental `git add .` | Files already committed earlier | \n| gitleaks `dir` /`git` | Known token formats, in files and history | Secrets in formats it does not know (the 215 above) | \n| Pre-commit hook | Catching it before the commit exists | Anyone who skips the hook | \n| GitHub push protection | Known secret types at push time | Unknown formats, and pushes where someone bypasses it | \n| Env vars instead of inline values | Keeping values out of saved rules | A key you already typed in | \n| Rotation | Any exposed API token or password | Wallet keys, and leaks you do not know about yet | \n\nStart with the free [Agent Blast Radius Checklist](https://paxtechservices.gumroad.com/l/agent-blast-radius?utm_source=devto&utm_medium=article&utm_campaign=claude-approvals-secrets). It is 9 pages for seeing what your coding agent can read, run and reach, then cutting it down.\n\nIf your agents also touch wallets, API tokens or signing power, [Agent Security When Agents Hold Keys](https://paxtechservices.gumroad.com/l/agent-security-keys-signing?utm_source=devto&utm_medium=article&utm_campaign=claude-approvals-secrets) ($12) is the plain-English playbook for shrinking the blast radius. All ten PTS AI + blockchain guides are in one [$39 bundle](https://paxtechservices.gumroad.com/l/ai-blockchain-guides-bundle?utm_source=devto&utm_medium=article&utm_campaign=claude-approvals-secrets), and there is a free [AI + Blockchain Map](https://paxtechservices.gumroad.com/l/ai-blockchain-map?utm_source=devto&utm_medium=article&utm_campaign=claude-approvals-secrets) if you want a 10-minute start.\n\nThe newsletter is at [https://paxtechservices.substack.com](https://paxtechservices.substack.com) if you want more notes like this.\n\n*I'm PTS, an IT and security consulting shop. Corrections welcome in the comments. Not affiliated with Anthropic or GitHub. Educational only, not legal or financial advice.*", "url": "https://wpnews.pro/news/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today", "canonical_source": "https://dev.to/paxtechnologyservices/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today-4g47", "published_at": "2026-12-05 17:05:42+00:00", "updated_at": "2026-12-05 17:13:33.497447+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "ai-safety", "developer-tools"], "entities": ["Claude Code", "Anthropic", "Apiiro", "Ars Technica", "GitHub", "gitleaks", "TruffleHog"], "also_reported_by": [], "takeaway": "Claude Code's \"don't ask again\" approvals persist Bash rules to .claude/settings.local.json, which can capture tokens from approved commands; Apiiro found over 100,000 such files on public GitHub, and 215 secrets evaded both gitleaks and TruffleHog.", "recommendation": {"advice": "Run git ls-files and git log --all on .claude/settings.local.json in every repo, scan with gitleaks, then untrack the file and add it to .gitignore.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today", "markdown": "https://wpnews.pro/news/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today.md", "text": "https://wpnews.pro/news/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today.txt", "jsonld": "https://wpnews.pro/news/your-claude-code-approvals-can-hold-your-api-keys-check-your-repo-today.jsonld"}}