Short answer
When a Claude Code user picks "Yes, and don't ask again" on a command that contains a password or token, Claude Code saves the whole command, secret included, as an allow rule in .claude/settings.local.json in the project folder. Apiiro's research, published November 5, 2026, found 1,122 public copies of that file on GitHub holding a real secret, and 2,539 distinct secrets in 1,994 repositories once file history, shared settings and agent transcripts were counted. Fix it by rotating exposed credentials first, then untracking the file, adding it to .gitignore and keeping secrets out of commands.
On November 5, the application security firm Apiiro published research showing that a convenience button in Claude Code, Anthropic's coding agent, has been saving passwords and API keys into a file that often ends up on public GitHub. Apiiro counted 2,539 real secrets in 1,994 public repositories, including database passwords, payment tokens and cloud keys. Most belong to individual developers, but 63 organizations are affected, from startups to software agencies. If your business has a developer, a freelancer or an agency writing code with an AI agent, it applies to you even if nobody on your team has heard of the file involved.
We use Claude Code every day and build client work on Claude models, so we have an interest here. We checked the repository behind this site before writing: the file was never committed.
What happened
Claude Code asks for permission before it runs most shell commands. One of the answers is "Yes, and don't ask again". Pick it and, according to Anthropic's permissions documentation, Claude Code saves a permanent allow rule to .claude/settings.local.json at the root of the project.
The trouble starts when the command contains a secret. Ask the agent why a login fails on a staging server and the command it proposes may include the database password from your config file, because the command cannot work without it. Apiiro's write-up shows that the saved rule is the command string itself, password and all. After the tenth approval prompt of a session, few people read every word of a long command line.

Anthropic does try to keep that file private. The settings documentation says that the first time Claude Code writes the file in a git repository, it adds **/.claude/settings.local.json to your personal global git excludes, and that if you create the file by hand you should add it to .gitignore yourself. Apiiro's point is that the protection lives on one laptop. It does not travel with the project, so it misses a folder that becomes a repository later, a clone on another computer and a file already committed. In 539 of the 1,105 affected repositories Apiiro traced, a commit co-authored by Claude itself had changed the file.
How big the leak is
Apiiro searched public GitHub from November 1 to 3 and found 104,185 copies of the file in 103,617 repositories. Of those, 1,122 files, about 1.1%, held a real secret: 1,379 distinct values. More than a third open a database directly, with 379 database passwords and 122 Supabase service-role keys. There were also 103 Supabase account tokens, 43 SSH logins, 42 GitHub, GitLab and npm tokens, 23 AWS keys and 6 private keys.
The named cases include a production Azure Postgres password at a B2B startup, a Square production token at a software agency, and the owner password for a medical-records database at an IT services firm. One organization confirmed its exposed key had been live.
Three findings affect how fast you should act:
- The files sit there for months. In the median affected repository the file had been committed 217 days before Apiiro looked, and in 118 repositories more than a year.
- Deleting the file does not remove the secret. Earlier versions held 734 secrets that appear in no current copy, and 211 forks of 74 repositories carry the same secrets.
- The longer someone has been clicking "don't ask again", the worse it gets. One in ten files over 8 KB held a real secret, against fewer than one in 500 under 500 bytes.
The habit is not limited to this file. Apiiro also found secrets in the shared .claude/settings.json that teams commit on purpose (298 files), in saved agent chat transcripts, in agent memory files and in handoff notes, some of them written by the agent.
Why your secret scanner may not catch it
Apiiro ran two widely used open-source scanners, gitleaks and TruffleHog, over every file. Of the 1,122 files with a real secret, gitleaks flagged 564 and TruffleHog 643. Neither flagged 215.

Scanners look for known key formats, such as a provider prefix followed by a long random string. A password typed after PGPASSWORD=, sshpass -p or mysql -p looks like any other word in a command, so it slips through. If your only safeguard is "GitHub would have warned us", it may not have.
What Anthropic has said
Users have reported the behavior since August 2025. GitHub issue #5544, opened on August 11, 2025, describes the same behavior and was closed automatically as inactive in January. After Apiiro's post, Boris Cherny, Anthropic's head of Claude Code, wrote in the Hacker News discussion that "Historically Claude Code has not done secret scrubbing" and, as Apiiro's update records, that the team plans to prototype fixes such as built-in secret scanning and having auto mode catch it. He also recommended auto mode over saved permission rules, and turning on the secret scanning that GitHub offers. No fix had shipped when we published.
Apiiro also compared how 16 coding agents store approvals, using their documentation, and says Claude Code is the only one confirmed to write the full approved command to a project file by default. That does not make the others safe: the same password-in-a-command problem shows up in transcripts and memory files from other tools.
What we would do this week
Whoever maintains your code can run these checks, in this order.
- Ask everyone who writes code for you, including freelancers and agencies, which AI tools they use on your projects and whether they have ever approved a command with "don't ask again".
- Search your GitHub organization for
path:.claude/settings.local.json org:your-org, and do the same for.claude/settings.json. Check each repository's history too, because a deleted file is still in it. - Rotate before you clean up. Any password, token or key that ever appeared in those files gets changed at the source: the database, Stripe or Square, the cloud account. Then run
git rm --cached .claude/settings.local.jsonand add the file to the repository's own.gitignore. - Have each developer open the file on their own laptop and delete every rule that contains a secret. Files that never left the machine are still readable by malware that searches disks for credentials.
- Keep secrets out of commands. A rule that records
$DB_URLleaks nothing; one that records the connection string leaks the password. Approve patterns such asBash(npm run *)rather than one-off commands. - Turn on scanning. GitHub scans public repositories for free. For private repositories, repository-level push protection is off by default and needs GitHub Secret Protection. Treat the
.claude/,.cursor/and.gemini/folders like a.envfile in your scans.
If you hire an agency, put the question in writing and ask for the answer in writing. Agencies were among the 63 organizations in Apiiro's list.
The wider lesson for AI agents
An agent that acts for you writes down what it did. That record is useful, and it is also a place for secrets to collect. We made the same argument about inboxes in our post on agents escaping the sandbox, and about approvals in our human-in-the-loop guide: an approval step only protects you if the person approving reads what they are approving. Clicking "don't ask again" on the tenth prompt of the afternoon is how that step stops working. If staff outside engineering have started using Claude Code for their own projects, as in the TV debloating trend we covered, show them this post before they publish anything to GitHub.
Frequently asked questions
Is this a bug in the Claude model?
No. It is how the Claude Code tool stores approvals. Apiiro reproduced it with Opus 5.5 and Fable 5.1, and says it happens whichever model is running. The approved command is saved word for word, so any password typed into it is saved too.
Doesn't Claude Code keep that file out of git?
Partly. Anthropic's documentation says that the first time Claude Code writes the file, it adds it to your personal global git excludes. That protects your own machine. It does not protect a file created by hand, a folder that becomes a repository later, a clone on another computer, or a file someone already committed, because nothing is added to the repository's own .gitignore.
We deleted the file. Are we safe?
Not until you rotate the credentials. Deleting the file leaves it in git history, forks and clones. Apiiro found 734 secrets in earlier versions of the file that appear in no current copy, usually because the file had been deleted.
What has Anthropic said?
Boris Cherny, Anthropic's head of Claude Code, replied on Hacker News on November 7 that the team is looking into ways to prevent it, including built-in secret scanning and having auto mode catch it. No fix had shipped when we published this post.




