
Why it mattersIf a Claude Code command carried a production key, rotate that key today. Then search its git history and Docker images.
A key printed into a Claude Code allow rule stays in the file as plain text. When the file reaches a public repository, the key goes with it. GitGuardian scanned public GitHub on 9 November 2026. It found 31,088 distinct secrets inside .claude/settings.local.json files. The files sat in 23,276 repositories. 5,343 of the secrets were still valid when the scan ran.
Apiiro ran its own scan in parallel and reached the same conclusion. The firm found 1,122 secrets in .claude/settings.local.json. It found another 1,160 in git history, in .claude/settings.json, and in committed chat transcripts. 63 of Apiiro's customer organisations were affected. InfoQ reported both findings on 22 November 2026.
How the leak happens
Claude Code asks before running a shell command. A user who answers "Yes, and don't ask again" writes an allow rule into .claude/settings.local.json. The rule is the command the model wanted to run. That command often holds an API key inline. Anthropic's documentation says Claude Code tries to keep the file out of commits. The first time it writes the file in a git repository, it adds **/.claude/settings.local.json to the user's global git excludes.
GitGuardian's Guillaume Valadon lists three cases the excludes miss. A folder can become a repository after the file already exists. A clone on another machine does not share the first machine's excludes. A file somebody already committed stays in the history. Each one puts the file back into git, with its keys.
What was in the files
GitGuardian broke its 5,343 valid secrets down by type. 1,955 were Postgres connection strings. 941 were Google API keys. 355 were Telegram bot tokens. 292 were SSH passwords. 391 were DeepSeek keys. 142 were Resend keys. The firm also scanned Docker Hub. It found 613 distinct secrets inside Claude Code settings committed to public images. 99 of those were valid. The images covered 543 image repositories and 7,625 image tags. One Cloudflare token appeared in 559 tags of the same image.
New leaks are falling. GitGuardian counted 12,535 new occurrences in April 2026. The number for October 2026 was 959, a 92 percent drop. The median file sat in a repository for 217 days before the firm's scan found it.
What Anthropic said
Boris Cherny leads Claude Code at Anthropic. He told InfoQ that "Claude Code has not historically scrubbed secrets". He said the team is looking into the problem. Two prototypes are in development: auto mode and built-in secret scanning. In the meantime, he recommends auto mode over broad permission rules, paired with GitHub's own secret scanning.
What to do about it
GitGuardian lists four actions. Rotate every credential the settings file has ever held. That covers keys in git history and in Docker images that embed the file. Add .claude/ to .gitignore and to .dockerignore. Delete every allow rule in the settings file that contains a secret. Use an environment variable reference such as $DATABASE_URL in the rule itself, so the key never enters the file.
A team that adopted Claude Code this year should assume the leak reached them too. At least one developer answered "don't ask again" on a command carrying a production key. The two scans say this is a common pattern. A leaked key does not become safe when the file is later removed from the repository.
Source
- The GitGuardian numbers and the four recommended actions: Guillaume Valadon on the GitGuardian blog.
- The Apiiro figures and the Boris Cherny quote: Sergio De Simone on InfoQ.
- How Claude Code adds the file to the global git excludes: the Claude Code settings documentation.
This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.
Get AI News in your inbox
New developer tools, model and agent releases, and how teams are actually using them to release software. Short, and only when there is something worth reading.

