Playbooks · Coding
Apiiro: 1,122 Claude settings files leak secrets
Written November 9, 2026
Clicking "Don't Ask Again" in Claude Code can save the exact command you approved — password included — into a file inside your project. Apiiro found 1,122 public copies of that file holding a real secret. Rotate first, then clean up.
The problem
Claude Code asks before it runs most shell commands. Pick "Yes, and don't ask again" and it saves an allow rule in .claude/settings.local.json inside the project, so matching commands run without asking in later sessions. Sometimes the rule is a pattern, such as npm test *. Sometimes it is the one exact command Claude offered — and if you typed a password or API key into that command, the secret is saved too, in plain text.
That file is meant to stay on your machine. Claude Code tries to keep it out of git: the first time it writes the file in a repository, it adds it to your global git excludes, so git on that computer ignores it in every repository. But the protection stays in one person's git settings on one computer. It never goes into the project's own .gitignore, so it does not travel with the project — and it does nothing for a file that was already committed.
What Apiiro found
Apiiro's report, published November 5 by Shmulik Cohen and Matan Giladi, searched public GitHub between November 1 and 3. The numbers below are Apiiro's, from that report:
| What was counted | Figure |
|---|---|
Public copies of .claude/settings.local.json examined | 104,185, in 103,617 repositories |
| Copies holding at least one real secret | 1,122 (about 1.1%), holding 1,379 distinct secrets |
| Database passwords among the secrets | 379 |
| SSH logins for public servers | 43 |
| GitHub, GitLab and npm tokens | 42 |
| AWS keys | 23 |
| Organizations holding a secret in a public file | 63 |
| Total secrets including git history, shared settings and agent transcripts | 2,539, across 1,994 repositories |
A value counted as a secret when it matched a known key format, or when a password or token sat beside the address of a public server, and an AI reviewer also had to agree. Apiiro did not test whether any of the credentials still work, so the count is a measure of exposure, not of confirmed compromise. One company the researchers notified confirmed its exposed key had been live. No use of any secret by anyone else is reported.
Two details make the count a floor rather than a ceiling. Older versions of the file hold 734 more secrets across 509 repositories that no current copy holds, usually because the file was deleted — and deleting the file does not remove it from git history. Forks spread the files further: 211 forks of 74 repositories carry the same secrets as the originals. Every file with a secret was still on its repository's default branch when Apiiro collected the data, and in half of those repositories it had been there for at least 217 days.
Apiiro also found secrets in 298 of 76,011 copies of the shared .claude/settings.json file, which teams commit on purpose, mostly inside allow rules. And in 539 of the 1,105 repositories the researchers traced, a commit listing Claude as a coauthor had changed the settings file — Apiiro reads that as Claude often committing the file itself.
What to do
Apiiro's advice, in order:
- Rotate first. Change every password, token, and key the file has ever held, before cleaning anything up. Deleting the file does not undo the leak: older versions stay in git history and in forks.
- Search your organization. Search GitHub for
.claude/settings.local.jsonand.claude/settings.json, and check each repository's git history for them, even where the files are gone. - Stop tracking the local file. Run
git rm --cached .claude/settings.local.jsonand add the path to the repository's own.gitignore, so the protection travels with the project instead of living in one person's git settings. - Open the file on your own computer. Even if it was never committed, open it and delete every rule that contains a secret. The file is plain JSON in the project folder, and copies can also sit inside an npm package, a Docker image, a zip archive or a synced folder.
- Keep secrets out of commands. Refer to them as variables from a secrets manager, such as
$DB_URL, so the saved rule holds the variable name and not the secret. - Approve patterns, not single commands. A pattern such as
Bash(npm run:*)cannot carry a password the way one exact command can.
What scanners miss
Do not trust a clean scanner report on this file. Apiiro ran gitleaks and TruffleHog over every copy without the tools' verification step: of the 1,122 files with a secret, gitleaks flagged 564 and TruffleHog 643, and neither flagged 215. Most misses are passwords typed inside commands — a password after PGPASSWORD=, sshpass -p or mysql -p looks like an ordinary word in an ordinary command line, not a key in a recognizable format. Apiiro also compared the documentation of 16 coding agents and reports Claude Code as the only one confirmed to save the full approved command in a project file by default. It reproduced the behaviour with Opus 5.5 and Fable 5.1, so the model in use makes no difference.
For security teams, Apiiro recommends treating agent folders such as .claude/, .cursor/, .gemini/ and .specstory/, and agent memory files, as holding secrets, like .env files — on laptops as well as in repositories — and adding them to pre-commit and CI secret scanning, including git history, with a scanner that catches passwords inside commands.
Limits
- All figures on this page are Apiiro's, from its November 5 report. The credentials were not tested, so nothing here shows a secret was used — only that it was exposed. One notified company confirmed its key had been live.
- Claude Code users have reported this behaviour before: an earlier bug report, filed August 11, 2025, said approved commands with API keys and tokens were being stored word for word in
settings.local.json. It was closed by an automated bot on January 3 as "not planned" after 60 days without activity. The four related reports Apiiro cites have all been closed by the same bot, the most recent the day before the report, and none received a reply from Anthropic. - This page covers the settings-file leak only. It says nothing about secrets in other agent files, other than the shared settings file and agent transcripts Apiiro counted in its wider total.
Related playbooks
- Cloakroom: hide your secrets from your agent
- Check for planted instruction files before you start an agent in a folder you did not fill yourself
- Claude Code 2.1.327 lists broken setup files
- Copilot CLI 1.0.106: /code, /settings, GPT-6.1 Terra
Sources
- Coding Agents Are Leaking Your Secrets to GitHub — Apiiro
- Claude Code's "Don't Ask Again" File Exposes Passwords and Keys in 1,122 Public Copies on GitHub — The Hacker News
Back to: Coding playbooks hub · Also: Check every package name your agent invents · Audit apps that installed agent plugins for you · MCPhantom: agents install dead MCP servers