Agents gone wrong
Claude Code approvals left 31,088 secrets in files on public GitHub, 5,343 still working
When you answer "Yes, and don't ask again" to a shell command, Claude Code saves the whole command as a rule in .claude/settings.local.json, including any API key or password typed into it. GitGuardian scanned public GitHub and Docker Hub for copies of that file.
What the agent did
- GitGuardian counted 31,088 distinct secrets in .claude/settings.local.json across 23,276 public GitHub repositories from January 2025 through November 7, 2026; 5,343 (17%) were valid when detected, as reported
- Database logins were the ones most likely to work: 1,955 distinct valid Postgres connection strings in this one file type
- Leaks per month rose from 256 in June 2025 to a peak of 12,535 in April 2026, then fell 92% to 959 in October; GitGuardian says it does not know why
- Dockerfiles that copy the whole folder shipped the file into public Docker Hub images: 613 secrets, 99 valid, one Cloudflare token in 559 image tags
- In 263 repositories the commit that leaked the file was made under Claude's own git identity, by Claude Code or its GitHub action
What it means for you
- Rotate first: history, forks and Docker images keep old copies, so deleting the file does not take the secret back.
- Add .claude/settings.local.json to the repository's own .gitignore and to .dockerignore; Claude Code's automatic ignore lives only in your machine's global git excludes.
- Put secrets in environment variables ($API_KEY) so a saved approval stores the name, and prefer a narrow rule over a broad one like Bash(curl:*).
Why it matters
The leak needs no attacker and no bug in the usual sense: a convenience click turns a one-off command into a file that sits next to your code. Claude Code keeps the file out of git only on the machine that created it, so a second laptop, an older clone or a Docker build is enough. Apiiro, which published first on November 5, found the median leaking file had been public for 217 days.
Counts and validity checks as reported by GitGuardian, a secrets-scanning vendor, from its own monitoring; Apiiro's narrower count of current copies is 1,379 secrets, and Anthropic says Claude Code ignores the file when it creates it.
Source: GitGuardian Blog
Every number on this page comes from the source. Our charts redraw those numbers; videos are embedded from the publisher.
Comments
- Tried something like this? Share how it went for you.
Agents in this story
| # | Agent | Gid Score | Downloads 7d | 7d | 30d | Stars | Latest release | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 |
Claude CodeAnthropic |
89 | 21.7M | up 25.9% | up 18.1% | 156K+142/day | 2.1.330yesterday | ||||
More agents in action
Agents in actionGitHub's agents ported the Copilot runtime to 800,000 lines of Rust for about $120,000 in tokens
Agents in actionLoanPro's AI servicing assistant cuts account summaries from 3–5 minutes to under 15 seconds
Agents gone wrongAn OpenAI model broke into a government statistics site for one bed count and took 24 years of data