TL;DR: Security researchers found more than 30,000 real secrets, API keys, database passwords, and tokens sitting inside a Claude Code settings file across tens of thousands of public GitHub repositories. The culprit is the “Yes, and don’t ask again” button, which saves the whole command, credentials included, as a standing approval rule.

Thirty one thousand and eighty eight. That is how many distinct secrets security firm GitGuardian found hiding inside a single configuration file, spread across 23,276 public GitHub repositories. Of those, 5,343 were still live and usable when GitGuardian’s scanners checked them.
The file in question is .claude/settings.local.json, a small project level settings file that Anthropic’s coding assistant Claude Code creates automatically the first time a developer approves a shell command. Here is the mechanism that turned a convenience feature into a leak source. When Claude Code wants to run something like a curl request or a database command, it asks for permission. Click “Yes, and don’t ask again,” and the tool saves that exact command as a permanent allow rule so it never has to ask about that command again. The problem is that the saved rule is the literal string the developer typed, and if that string contains a password, an API key, or a database connection string, the credential gets written straight into the settings file along with it.
A separate research effort from Apiiro, published a few days earlier, scanned a slightly different slice of GitHub and came back with smaller but still alarming numbers: 104,185 copies of the settings file across 103,617 repositories, with 1,379 distinct real secrets confirmed inside 1,122 of them. Apiiro’s breakdown skewed heavily toward database credentials, which made up roughly 78 percent of the itemized secrets it could categorize, followed by SSH credentials and version control tokens that can open up an entire private codebase to anyone who finds them.
Database passwords dominate for a boring but logical reason. Developers routinely ask Claude Code to connect to a Postgres or MySQL instance directly from the terminal, typing something like PGPASSWORD=hunter2 psql -h db.example.com -U admin orders. Approve that once with “don’t ask again,” and the password sits in plain text in a file that was never designed to be secret in the first place.
Anthropic’s defense has a real gap in it, and the company has said so itself. Boris Cherny, who leads Claude Code at Anthropic, acknowledged on Hacker News that the tool has “historically not done secret scrubbing,” and said the team was looking into fixes, including built in secret scanning. That is a candid admission, but researchers at Apiiro note that developers had flagged this exact behavior in GitHub issues going back to August 2025, more than a year before either report landed, and that several of those issues were closed automatically without a response.
Removing the file after the fact does not fully solve the problem either. Apiiro found 734 additional secrets, spread across 509 repositories, buried in older commits in Git history, meaning a developer who deleted the exposed file today could still have working credentials sitting in a commit from six months ago that anyone can still check out.
There is also a Docker wrinkle that makes cleanup harder than it sounds. Claude Code normally adds the settings file to a project’s local Git ignore rules automatically, which keeps it out of version control on that one machine. But that protection is local, not global, so a developer working across multiple clones, or building a Docker image from a project directory, can accidentally bake the file straight into a container. GitGuardian found 613 distinct secrets sitting in publicly available Docker Hub images this way, 99 of them still valid.
Supply chain leaks like this one keep landing in the same category as the Optimizely breach that hit 178 organizations including the BBC and CNN through a third party plugin. The common thread is never the attacker’s sophistication. It is a trusted tool, quietly doing something its users never meant for it to do.
What this does not prove, and what it does
It is worth being precise about what these numbers actually show. They are not evidence that Anthropic’s servers were breached, and they are not proof that any specific credential was used by an attacker to break into anything. What they confirm is narrower but still serious: developers approved commands containing real secrets, Claude Code faithfully saved those commands verbatim, and a meaningful share of those developers then pushed the resulting file to a public repository without reviewing what was inside it. The chain of custody runs through human choices at every step, but the tool made each of those choices easier to make badly.
For teams already running Claude Code, the fix researchers recommend is straightforward and does not require waiting on Anthropic. Run git check-ignore -v .claude/settings.local.json to confirm the file is actually being ignored in your repository, then git log --all --oneline -- .claude/settings.local.json to see whether a tracked copy ever slipped into history. A tighter permissions file helps too: an explicit deny rule for .env files and a secrets directory, paired with an “ask” rule for anything touching git push, keeps the assistant from quietly building up dangerous standing permissions in the first place. The best advice from both research teams is the simplest one: keep credentials out of commands entirely by referencing environment variables like $DB_URL instead of typing the raw value, so there is nothing sensitive for the approval system to save.
The bottom line
This is not really a story about Claude Code being insecure. Every AI coding assistant that can run shell commands faces the same tradeoff between convenience and credential hygiene, and “don’t ask again” is a feature every developer has wanted at 2am during a long debugging session. The real lesson is that a tool built to remember your preferences will remember exactly what you typed, secrets and all, unless someone builds in a filter to stop it. Until Anthropic ships that filter, the burden sits with developers to treat their own settings files with the same suspicion they would apply to a stray .env file, because right now, functionally, that is exactly what it is.



