Moderate evidence
More
Claude Code settings.local.json Secrets: 17 months of exposure on GitHub, & Docker Hub
- Evidence type
- Observational study
- Sample
- n = 31,088
- Sources
- 1 sourceJournalism
- Published
- 3 min read
- Truvace record
- TRV-2026-3107cite or check it
TL;DR 31,088 secrets, 5,343 valid: GitGuardian found 31,088 distinct secrets in Claude Code’s .claude/settings.local.json on public GitHub, across 23,276 repositories, and 5,343 of them worked when we detected them. “Yes, and don’t ask ag…
The problem
GitGuardian's scan of public GitHub from January 2025 to November 7, 2026 found 31,088 distinct secrets in Claude Code's .claude/settings.local.json across 23,276 repositories, and 5,343 of them were valid when detected.
In brief
GitGuardian reports that Claude Code's .claude/settings.local.json file exposed 31,088 distinct secrets across 23,276 public GitHub repositories between January 2025 and November 7, 2026. Of those, 5,343 (17%) were valid when detected. The cause is the "Yes, and don't ask again" option, which saves the approved command, API key included, as an allow rule in the project file.
The exposure spread past GitHub. Public Docker Hub images carry the files across 543 image repositories and 7,625 tags, holding 613 distinct secrets, 99 of them valid. One valid Cloudflare API token appears in 559 tags of a single image, and deleting the file from the repo does not remove images already pushed.
Monthly leaks in the file peaked at 12,535 occurrences in April 2026 and fell to 959 by October, a 92% drop. GitGuardian says it does not know what changed and has not finished ruling out changes on its own side. Anthropic's Claude Code lead Boris Cherny said on Hacker News that the team is looking into the problem.
Main points
- settings.local.json held 71,525 occurrences across 11,336 authors; the shared settings.json held 8,271 distinct secrets, 1,283 of them valid at detection.
- Bearer tokens in curl commands make up the volume (50% of sampled rules), while database and SSH credentials are the ones that work: 1,955 valid Postgres connection strings and 292 valid SSH passwords.
- Generic detectors account for 63% of occurrences (44,755 of 71,525), so scanners that only match provider key formats miss most of the file; Apiiro measured that gitleaks and TruffleHog together miss one in five leaking files.
- Personal email domains account for 15,993 distinct secrets (4,270 valid); corporate domains hold 5,924 (1,499 valid) and academic domains 426 (103 valid).
- In 263 repositories the leaking commit carries Claude's noreply address as author, covering 406 secrets, 107 of them valid.
- CLAUDE.md holds 6,155 distinct secrets, 2,537 valid, the highest validity rate of any file examined; .claude/.credentials.json appears in 371 repositories.
- Cherny said Claude Code gitignores the file when it creates it, so exposed copies were likely created manually and committed; GitGuardian replies that every inspected secret sat in an allow rule of the shape the permission prompt writes.
The full story
The mechanism is simple: when a user approves a shell command containing a credential with "Yes, and don't ask again," Claude Code writes an allow rule containing the literal command string into .claude/settings.local.json. The file is kept out of git on the user's own machine, but nothing in the repository ignores it, so it can be committed from another machine, an older clone, or when already tracked.
GitGuardian scans every public commit as pushed, so it saw versions later deleted or force-pushed away. Apiiro counted 1,379 secrets in current copies plus 734 in history without testing validity; GitGuardian counted everything ever pushed and checked validity automatically. Where a check returned a verdict, 67% of occurrences in settings.local.json and 57% in settings.json were valid.
In a sample of about 3,000 occurrences, every secret sat in an allow rule or an env block, none in deny. A quarter of leaking settings.json versions point Claude Code at third-party gateways, leaking 205 valid DeepSeek keys, 62 OpenRouter keys and 50 MiniMax keys. All 30 agents' config files counted leak MCP server keys, but only settings.local.json is dominated by credentials typed into commands.
For Docker Hub, 72% of occurrences sit under /app, /workspace or /usr/src, indicating a COPY . . instruction that ships the working tree. One database password appears in 643 tags across seven image repositories. GitGuardian advises rotating every secret first, then adding the file to .gitignore and .dockerignore.
Sources
1 on file- GitGuardian Blog - Take Control of Your Secrets Securityblog.gitguardian.com
Talk it over
Cherny said exposed copies were likely created manually and committed, while GitGuardian says every inspected secret sat in an allow rule of the shape the permission prompt writes. Which account fits the 31,088 secrets better, and why?
Claude Code settings.local.json Secrets: 17 months of exposure on GitHub, & Docker Hubhttps://truvace.com/item/claude-code-settings-local-json-secrets-17-months-of-exposure-on-github-docker-h
Cherny said exposed copies were likely created manually and committed, while GitGuardian says every inspected secret sat in an allow rule of the shape the permission prompt writes. Which account fits the 31,088 secrets better, and why?
Answer in the threadIf you were a developer who had clicked "Yes, and don't ask again" on a command containing an API key, what would you do first on learning the key could sit in a public commit?
Answer in the threadMonthly leaks in the file fell from 12,535 occurrences in April 2026 to 959 by October, and GitGuardian does not know why. What finding would convince you the drop reflects real change and not a change in detection?
Answer in the thread
If you have more time
Docker Hub images carried 613 distinct secrets, and one Cloudflare API token appears in 559 tags of a single image. How would you find out whether a project you know ships its working tree in an image?
Answer in the threadPersonal email domains account for 15,993 distinct secrets and corporate domains for 5,924. Who should be responsible for checking what individual developers commit: the developers, their employers or the makers of the tool?
Answer in the thread
ace



What readers say