Claude Code approval files leak 5,343 live secrets on public GitHub

GitGuardian found 31,088 distinct secrets in Claude Code approval files across 23,276 public GitHub repositories, with 5,343 credentials still valid at detection, because the agent saves shell commands verbatim when users choose permanent approval.

Christopher Ort
By Christopher Ort · 4 min read
Share
A developer's laptop screen showing terminal commands with visible API keys, photographed from behind in a dimly lit office
Image: AI-generated, i10X
On this page
  1. Quick Take
  2. In plain English
  3. What happened
  4. Who is affected
  5. What you should do
  6. What it means
  7. Sources

GitGuardian published a scan of public GitHub and Docker Hub on November 9, 2026, counting 31,088 distinct secrets in Claude Code approval files across 23,276 repositories and 11,336 authors, with 5,343 of them still valid when detected.

i10X Quick Take

Quick Take

  1. What: Claude Code saves approved shell commands verbatim in .claude/settings.local.json, including any API keys or passwords typed in the command
  2. Who is affected: 23,276 public GitHub repositories and 543 Docker Hub image repositories, with 1,955 valid Postgres connection strings among the leaked credentials
  3. What to do: Rotate every secret ever held in approval files, add .claude/, .cursor/, .gemini/, .codex/, .mcp.json and CLAUDE.md to .gitignore and .dockerignore, and scan repository history
  4. Status: No fix had shipped from Anthropic when GitGuardian published on November 9, 2026
  5. Root cause: Answering Yes, and don’t ask again to a shell command prompt makes Claude Code save the full command as typed, so credentials inside the command are written to disk

In plain English

Claude Code is an AI coding assistant that asks permission before running shell commands. When you click Yes, and don’t ask again, it saves the entire command exactly as you typed it, including any passwords or API keys. Researchers found over 31,000 secrets sitting in these approval files on public GitHub, and more than 5,000 of them still worked. If you use Claude Code or similar AI coding tools, you need to check your repository history for leaked credentials and change them, then make sure the approval files are in your .gitignore and .dockerignore. If you don’t use these tools, you can ignore this.

What happened

GitGuardian published a scan of public GitHub and Docker Hub on November 9, 2026, counting 31,088 distinct secrets in .claude/settings.local.json across 23,276 repositories and 11,336 authors, with 5,343 of them still valid at detection. Apiiro reported the same exposure pattern days earlier with a smaller, conservatively filtered count and no validity check. No fix had shipped from Anthropic when GitGuardian published.

Answering Yes, and don’t ask again to a shell command prompt makes Claude Code save that approval as an allow rule holding the full command as typed, so an API key or a password inside the command is written to disk. Anthropic’s own documentation says Claude Code adds the file to the user’s global git excludes the first time it writes it, which means a repository that already tracks the file, or a file the developer created by hand, is not covered.

Container images built with COPY . . ship the working tree, so git-ignored files travel into the image unless .dockerignore excludes them. GitGuardian scans every public commit as it is pushed, so its count includes versions later deleted or force-pushed away.

Other agent files leak too

GitGuardian found secrets in multiple agent configuration files:

  • .claude/settings.json: 8,271 distinct secrets across 6,839 repositories, 1,283 valid
  • CLAUDE.md: 6,155 distinct secrets, 2,537 valid
  • .claude/.credentials.json: 1,366 tokens
  • .codex/auth.json: 1,064 tokens

On Docker Hub, 543 image repositories and 7,625 tags carried 613 distinct secrets, 99 of them valid.

Who is affected

Database credentials are the most valuable of what leaked: 1,955 distinct valid Postgres connection strings, plus valid SSH passwords, MongoDB URIs and Google, Telegram, Resend and DeepSeek keys.

Personal email domains account for 15,993 distinct secrets and corporate or custom domains for 5,924 across 3,338 domains, with education, research and software services making up about three-quarters of matched organizations.

What you should do

Rotate every secret an approval file has ever held, because deleting the file does not revoke the credential. Add .claude/, .cursor/, .gemini/, .codex/, .mcp.json and CLAUDE.md to .gitignore and .dockerignore and remove credential-bearing rules through /permissions.

Reference secrets as variables and approve narrow command prefixes rather than broad ones such as Bash(curl:*).

Treat .claude/, .cursor/, .gemini/, .codex/, .mcp.json and CLAUDE.md as secret-bearing like .env, and scan them at pre-commit, in CI, in git history and in container registries.

How to check your repository

Search your repository history, not only the files at the current commit, because GitGuardian’s companion lab test found just 2 of 9 planted credentials sitting at HEAD. Scan .claude/settings.local.json, .claude/settings.json, .claude/.credentials.json, CLAUDE.md and .codex/auth.json, then extend the same scanning to any container image built from the working tree.

What it means

GitGuardian reports that Claude Code lead Boris Cherny said on Hacker News that the team is investigating, that Claude Code has not historically scrubbed secrets, and that an auto mode and built-in secret scanning are being prototyped. Until then, approving a command that contains a credential writes it to disk.

Deleting the file revokes nothing, so rotate every credential it ever held first. GitGuardian scans each public commit as it is pushed, which means its count includes secrets that authors later deleted or force-pushed away, and anyone watching the same stream could have captured them.

GitGuardian also calls its own validity figures floors, because detectors without a checker were not counted as valid. The two researchers measured differently: GitGuardian scans every public commit as it is pushed, catching versions later removed, and ran read-only validity checks on its detections. Apiiro used a conservative filter and did not test whether the secrets still worked.

Sources

Christopher Ort

Christopher Ort

Christopher Ort handles SEO, AI agent workflows and PR & partnerships at i10x.ai, the all-in-one AI workspace built by i10X Global Pte. Ltd. in Singapore. He is a graduate of Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU). He is the author of “The Style Penalty”, a study published on SSRN that analyses 1,576 evaluation decisions by four frontier AI models to show how AI-written CVs fare in automated hiring screens; the research has been covered by heise online and t3n.

Editor's picks

  1. GitGuardian maps 45 agentic pentest frameworks, finds 11 expose consoles by default
  2. CVE-2026-129130: agent-device file:// URL disclosure lets remote callers read host files
  3. Claude Code approval files leak 5,343 live secrets on public GitHub
  4. OpenAI reports reinforcement learning raises chain-of-thought controllability
  5. Agent Incident Ledger: 57 of 66 AI agent incidents had no attacker