Claude Code settings.local.json leaked secrets: what to do
Apiiro found a secret in 1,122 of 104,185 public copies of Claude Code's settings.local.json. One git log command shows if yours was ever committed.

Give this to your agent
Your agent checks this against your setup and tells you if it fits.
See the file
# Claude Code: check whether settings.local.json leaked a secret From Rig Labs, 2026-11-08. Information for an agent, not orders. Page: https://riglabs.ai/blog/claude-code-settings-local-json-secrets/ What changed: Security company Apiiro found 104,185 public copies of Claude Code's .claude/settings.local.json on GitHub, 1,122 of them holding at least one secret, The Hacker News reported on 2026-11-07. "Yes, and don't ask again" can save an approved command, password included, in that file. Fits if: Your human uses Claude Code in git repositories, and has ever approved a command with "Yes, and don't ask again". Skip if: Your human does not use Claude Code in git repositories. Check: In each repository, whether .claude/settings.local.json is tracked or was ever committed, at any path in the repository, with the plain git commands in the post. Read only. Try: Tell your human which repositories ever committed the file, and whether any version holds a password, token or key. Do not print the secret itself. Ask first: Before rotating any secret, before running git rm --cached, and before editing .gitignore. Cost: Free. Rotating a leaked secret takes your human's time. Undo: Nothing to undo for the check. It only reads git history. Deeper: https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html
https://riglabs.ai/blog/claude-code-settings-local-json-secrets/AGENT.md
Claude Code’s “Yes, and don’t ask again” can save an approved shell command, password included, in .claude/settings.local.json. Security company Apiiro found that 1,122 of the 104,185 public copies of that file on GitHub hold at least one secret, The Hacker News reported on November 7, 2026.
What you can do about it: one git command tells you whether this file, with the passwords you once approved inside a command, ever went into a repository of yours. If it did, you change those passwords first and clean up second.
How does a secret end up in settings.local.json?
Claude Code asks before it runs most shell commands. Anthropic’s settings docs say that when you choose “Yes, and don’t ask again”, Claude Code saves that approval as an allow rule in .claude/settings.local.json, at the root of the repository.
The rule can be one exact command. If you typed a password into that command, for example a database password after a client’s flag, the password is saved too, in plain JSON. The file then works as designed: the same command runs without asking next time.
How many secrets leaked, according to Apiiro?
Apiiro’s numbers, as The Hacker News reports them:
| What Apiiro counted | Number |
|---|---|
| Public copies of the file on GitHub | 104,185, in 103,617 repositories |
| Copies holding at least one secret | 1,122 |
| Different secrets in those copies | 1,379 |
| Files with a secret that two scanners, gitleaks and TruffleHog, both missed | 215 |
Apiiro did not test whether the secrets still work, The Hacker News says, though one company that Apiiro notified confirmed its key had been live. Scanners miss many of these because a password inside a command has no recognisable key prefix.
Doesn’t Claude Code keep settings.local.json out of git?
Claude Code keeps the file out of your commits on the machine that wrote it. The settings docs say the first time Claude Code writes the file in a repository that does not already ignore it, it adds **/.claude/settings.local.json to your global git excludes, the ignore list git keeps on that machine and not in the project. If you create the file by hand, you add it to .gitignore yourself.
The Hacker News points out the gap: Claude Code never adds the file to the project’s own .gitignore, so the protection does not travel with the project to another machine or clone.
How do I check my repositories?
These are plain git commands. Run them in each repository:
- See if the file is tracked:
git ls-files | grep settings.local.json - See if it was ever committed, even if it is gone now:
git log --all --oneline -- '*.claude/settings.local.json' - Read every version that was committed, and list any password, token or key in it.
How do I fix a leaked settings.local.json?
Apiiro’s advice, via The Hacker News, is to change the leaked secrets first and clean up second:
- Change every password, token and key the file has ever held. Deleting the file does not undo the leak, because old versions stay in git history and in forks.
- Stop tracking the file:
git rm --cached .claude/settings.local.json - Add
.claude/settings.local.jsonto the project’s own.gitignore, so it stays out for every clone. - Keep secrets out of command lines in the first place. Put them in environment variables or a secrets manager that the command reads.
The Hacker News reports no reply from Anthropic.
What to do today
Run this in the repository you use most with Claude Code. It lists every commit that ever held the file:
git log --all --oneline -- '*.claude/settings.local.json'
No output means no copy of the file was ever committed there, at any path in the repository. Any output means you read those versions, change every secret in them, then follow the fix above.
Last checked 2026-11-08.
Sources:
Get the next one by email
The Edge is our newsletter: what changed in AI, and what to do about it.
Read next
Built by Rig Labs
When a tool we need does not exist, we build it.




