Claude Code Leak Exposed 2,539 Real Secrets

One click leaked 2,539 real secrets. That is the count from security firm Apiiro, which found database passwords, cloud keys, API tokens, and SSH root logins in public GitHub repositories, all because developers clicked “Yes, and don’t ask again” in Claude Code.

Apiiro published the research on November 5, 2026. It examined 104,185 public copies of Claude Code’s .claude/settings.local.json file; 1,122 of them, about 1.1%, held a real secret.

How one click saves your password

Claude Code is Anthropic’s coding agent. When it needs to run a shell command, such as querying a database, it asks for permission first. One option is “Yes, and don’t ask again,” a standing approval so the command can run without another prompt.

That approval is saved as an allow rule in .claude/settings.local.json, inside the project folder. Anthropic’s own settings documentation confirms this.

The problem is what the saved rule contains. If the command included a literal password or token, Apiiro reports, the exact command is saved word for word, secret included.

But that safeguard belongs to one machine, not to the project. It does not travel with the repository, and it does not cover a file that is already tracked.

What Apiiro measured Count
Public copies of .claude/settings.local.json examined 104,185 files in 103,617 repos
Files holding a real secret 1,122 files (1.1%)
Distinct secrets in those files 1,379 (636 provider keys, 743 passwords/tokens)
Total across history, shared settings, transcripts 2,539 secrets in 1,994 repos
Organizations affected 63
Files flagged by neither scanner 215 of 1,122

Every figure above is Apiiro’s own, from its November 5 research. Apiiro did not test any credential or contact any host, so “real secret” means a credential matching a provider format or pointing at a public host, not one proven to still work.

What actually leaked

The exposed credentials were not test keys. Apiiro’s examples include a database vendor’s own admin-level cloud key, a production Azure PostgreSQL password, a Square production token, and the owner password for a medical-records database.

Apiiro found 379 database passwords and 122 Supabase service-role keys, plus cloud credentials, private keys, package-registry tokens, and 43 SSH logins, some containing root passwords. Secrets also appeared in the shared .claude/settings.json file in 298 of 76,011 public copies checked.

The 217-day problem

In the median leaking repository, the file was first committed 217 days before Apiiro’s November 2 snapshot, according to coverage of the research. Most had sat in public for months.

How a secret travels from your terminal to public GitHub

1. You ask Claude Code to check a database → 2. It proposes a command with the password in it → 3. You click “Yes, and don’t ask again” → 4. The exact command is saved to .claude/settings.local.json → 5. The file is committed and pushed → 6. Anyone on GitHub can read it

The fix breaks the chain at step 3: never approve a command that contains a literal secret.

Why your scanner probably missed it

Apiiro ran gitleaks and TruffleHog over all 104,185 files. Of the 1,122 files with a real secret, gitleaks flagged 564 and TruffleHog flagged 643. Neither flagged 215.

That is about 19% of the secret-bearing files, invisible to both tools. A password typed inside a command, such as after PGPASSWORD=, often has no recognizable key format.

How to profit: the rotate-first fix checklist

If you use Claude Code for client work, sell this as a paid security audit. Rotation comes first, because deleting a file does not revoke a key that is already public.

  1. Search every repo you touch for .claude/settings.local.json and .claude/settings.json.
  2. Rotate before you delete. Revoke every exposed credential at its issuing system first, then verify the replacement works.
  3. Untrack the local file. Run git rm –cached .claude/settings.local.json and add the path to the repo’s own .gitignore.
  4. Clean the history. Search git history, not just current files, for the same secrets, and assume forks and clones already hold copies.
  5. Review the shared file. Read every allow rule in the committed .claude/settings.json and remove any literal secret.
  6. Check transcripts and notes. Apiiro found secrets in saved agent conversations and deployment notes too.
  7. Stop the leak at the source. Never put a literal password in a command you approve. Use a secret manager instead.

FAQ

Was Claude Code hacked?

No. Apiiro’s findings do not show a breach of Anthropic’s infrastructure. They show credentials saved in approval files during legitimate work, then published in public repositories.

Does “2,539 secrets” mean 2,539 live keys?

No. The total covers distinct classified secrets across current files, git history, shared settings, and transcripts. Apiiro did not test any credential.

How does “Don’t Ask Again” create the risk?

Anthropic’s documentation says choosing “Yes, and don’t ask again” for a Bash command saves an allow rule in .claude/settings.local.json. Apiiro reports that an exact command can be saved word for word, secret included.

Does deleting the file fix an exposed key?

No. Rotate or revoke the credential first, with the system that issued it. Earlier commits, forks, and clones can still hold the value.

Why didn’t gitleaks or TruffleHog catch it?

Both tools look for recognizable key formats. A password embedded in a command often has no such format. Gitleaks flagged 564 of 1,122 files, TruffleHog 643, and neither flagged 215.

Should I ignore the shared settings.json file too?

Not automatically. The shared file is intentionally committed for team settings. Review it for secrets, keep the team configuration, and remove any literal credential.

How do I stop this happening again?

Keep literal secrets out of command text, use secret-manager references, and keep approvals narrow. Add the local file to the repo’s own .gitignore, and scan history and transcripts too.

Sources

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top