"Don't Ask Again" Is a Config File: Approvals Leak Secrets

On 5 November, Apiiro published its count. Of 104,185 public copies of .claude/settings.local.json on GitHub, 1,122 held a real secret. Counting git history, the shared settings.json and saved agent transcripts, the total came to 2,539 secrets across 1,994 repositories. 379 of them were database passwords.
The mechanism is one click. Claude Code asks before running a shell command, and one of the answers is “Yes, and don’t ask again.” Pick it, and Claude Code writes a permission rule into that file so it never asks again. When the rule is for the exact command, the rule is the command. If the command had a password in it, so does the file.
So I audited my own. Across 41 settings files on my laptop there are 204 approval rules, and none of them holds a secret. That should have been the end of the post. It wasn’t. The same audit found the file committed to two repositories, by other people, and showed me why. In five of my repos, the only thing keeping settings.local.json out of git is an ignore rule on my machine, not in the repo.
Key Takeaways
- Apiiro found secrets in 1,122 of 104,185 public
settings.local.jsonfiles, and 2,539 secrets across 1,994 repos once history,settings.jsonand transcripts were included. It did not test whether they still work.- An approval rule records the command you approved. A prefix rule (
npm run test:*) carries nothing. An exact rule carries everything you typed, credentials included.- My 204 rules: 157 prefix, 47 exact, 4 exact rules carrying values, 0 secrets. That came from habit (credentials live in env files), not from any control.
- On my machine, every
settings.local.jsonis ignored, and in 5 of 14 repos the only rule doing it is in my user-level git config. A teammate without that rule commits the file. Two of my repos have it committed, once through a merged PR and once by a scaffolding plugin.- The fix that holds is in the repo: a
.gitignoreline and a CI check that fails if the file is tracked. Secret scanners are a backstop: of the 1,122 files, 215 slipped past both gitleaks and TruffleHog.
What did Apiiro actually find?
Apiiro found secrets in about 1.1% of the public copies of this file, and more than double that once history and neighbouring files are counted. The research, by Shmulik Cohen and Matan Giladi, started from the settings file Claude Code keeps per project for personal overrides. They pulled 104,185 public copies and classified 1,122 of them as holding at least one secret, 1,379 distinct secrets in all (RuntimeWire).
Then they widened the search. A secret removed from the file is still in git history. Some teams commit the shared .claude/settings.json, and the same rules land there. Saved agent transcripts repeat the commands verbatim. Counting all of it, Apiiro reported 2,539 secrets across 1,994 repositories belonging to 63 organisations (The Hacker News).
What they open is the uncomfortable part. More than a third of the secrets connect straight to a database, including 379 database passwords and 122 Supabase service-role keys (iTnews). A service-role key bypasses row-level security entirely.
Three caveats belong next to those numbers, and the coverage mostly left them out:
- Apiiro did not test the credentials. Some will be rotated, expired or pointing at a dead dev database. “Exposed” is not “exploitable”, though one organisation Apiiro notified confirmed its key had been live.
- Claude is not proven to have pushed every one. Apiiro traced commit history in 1,105 of the affected repositories and found commits co-authored by Claude changing the file in 539. That makes Claude Code the writer of the file, not necessarily the one who committed it.
- This was known. Apiiro says users have reported the behaviour in GitHub issues since August 2025. Those reports were closed automatically by a bot, as inactive or duplicate, with no reply from Anthropic.
As of this week there is no shipped fix. Boris Cherny, who leads Claude Code, replied in the Hacker News discussion on 7 November: “Historically Claude Code has not done secret scrubbing (there are many good tools for that), but we are looking into what we can do to prevent this” (iTnews). No date came with it, and Anthropic’s settings documentation still describes the behaviour as it was.
How does one click become a committed secret?
The chain has five links, and only the first involves a decision anyone thinks about:
- The agent proposes a command with a credential in it.
PGPASSWORD=... psql -h prod-db ..., or acurlwith a bearer token, often because the credential was pasted earlier in the conversation. - You approve it permanently. “Don’t ask again” is the answer that makes the prompts stop, and the permission prompt is already dying because people approve on reflex.
- Claude Code writes the rule as text. The documentation is explicit: choosing “Yes, and don’t ask again” saves the approval “as an
allowrule in.claude/settings.local.json.” The permission system matches Bash commands by prefix. A rule likeBash(npm run test:*)names a command family. An exact rule names one command, character for character. - The file is committed. It is meant to be ignored. Whether it is depends on the next section.
- The repo is public, or becomes public, or is forked by someone whose fork is.
Links 3 and 4 are where the leak actually happens, and neither one shows up as a prompt. The prompt you answered asked about running a command. It did not tell you that the answer would be saved in plain text, at a path your git add -A would happily pick up.
The distinction between prefix and exact rules is the whole risk surface, so I counted mine.
Three quarters of my rules are prefixes, and a prefix rule cannot carry a secret because it stops before the arguments. The 47 exact rules are the ones that could. Four of them carry some value, a URL or a flag argument, and the longest exact rule runs to 343 characters. None of the four is a credential. Each one is a command shape that would have carried one if I had typed it differently that day.
Why were my 204 rules clean?
I checked the current files and every commit that ever touched them. That is 25 repositories with settings files in their history and 1,094 commits. No added line matched any credential pattern I could write. That covered API key formats, passwords embedded in connection URLs, PGPASSWORD, bearer tokens and password=-style assignments.
The reason is not interesting, and that is the point. I never type a credential into a command. Database URLs come from .env files the tooling loads, cloud access comes from CLI profiles, and gh holds its own token. I have six exact rules for network, cloud and container tools (curl, aws, gh, docker and the like). None contains a secret, because there was never a secret in the command to save.
That is a habit, not a control. Nothing stops me pasting a connection string into a session at the end of a long day. The agent builds a command around it, and I click the answer that makes prompts go away. The audit shows that one person’s habits held across 204 decisions. It says nothing about the next one, or about anyone else in the same repos.
The audit has a limit of its own, and it is the same one Apiiro found in the scanners. “Clean” means nothing matched the patterns I wrote. A credential in a format I didn’t think of would have passed, just as 215 of Apiiro’s secret-bearing files passed both gitleaks and TruffleHog. I also read the 47 exact rules by eye, which is easy at that size and would not be at an organisation’s. Treat my zero as “nothing found”, not “nothing there”.
The gitignore that only exists on your laptop
Claude Code keeps the file out of git with a rule in your personal git config, not in the repository. The documentation says so directly: the first time Claude Code writes the file in a repo that doesn’t already ignore it, “it adds **/.claude/settings.local.json to your global git excludes file.” It also says that if you create the file by hand, adding it to .gitignore is your job.
On my machine, all 14 local settings files are ignored. So I asked git which rule was doing the ignoring:
git check-ignore --no-index -v .claude/settings.local.json
In 9 of the 14 repositories the answer is the repo’s own .gitignore. In the other 5, it is line 1 of ~/.config/git/ignore, my user-level ignore file. That file lives in my home directory. It is not in any repository, it is not reviewed, and it does not exist on a teammate’s laptop unless their own Claude Code put it there.
Which explains the two repositories where settings.local.json is committed. Both are client codebases I work in, and in neither case did the file come from me:
- In one, it arrived in a merged pull request in May. Whoever opened it either had no ignore rule or never had Claude Code create the file on their machine, so
git addsaw an ordinary file. - In the other, it arrived in July in a commit titled “chore: scaffold from migrate plugin”. A scaffolding tool copied a template
.claude/directory, local settings included, into a new repository. That is the “created by hand” case the documentation warns about, done by a tool. No human chose to commit it.
Both files are clean today. Both repositories will now commit whatever rule the next “don’t ask again” writes, for everyone who clones them. Once a file is tracked, no ignore rule applies to it.
This is the same lesson as hooks versus CLAUDE.md: a protection that depends on one machine’s state is a convenience, not a control. The repo is the unit that gets shared, forked and made public, so the repo is where the protection has to live.
What actually stops it?
A .gitignore line and a CI check stop the leak for everyone who clones the repo. Everything else is a backstop. In order of how much each one holds, cheapest first:
1. Put the ignore rule in the repo. One line in every repository’s .gitignore:
.claude/settings.local.json
This is the fix that covers teammates, CI, scaffolding tools and anyone who never ran Claude Code. If the file is already tracked, git rm --cached .claude/settings.local.json untracks it without deleting your copy.
2. Fail CI if the file is tracked. The ignore line stops new commits. It does nothing about a template that force-adds the file or a future rename. A three-line check does:
if git ls-files --error-unmatch .claude/settings.local.json >/dev/null 2>&1; then
echo "error: .claude/settings.local.json is committed; untrack it and rotate anything it held" >&2
exit 1
fi
3. Never approve an exact command that contains a credential. If the agent proposes one, say no and move the secret into the environment or a profile. If you want the command family approved, approve a prefix. This is the habit that kept my 204 rules clean, written down so it stops being a habit.
4. Block it before the prompt. A PreToolUse hook runs before the permission decision. It can refuse a Bash command that matches a credential pattern and tell the agent why. The prompt never appears, so there is nothing to approve and no rule to write. The same hook belongs in front of the rest of your trifecta, since a command carrying a production credential is an exfiltration path in waiting. If the agent runs inside a sandbox, keep production credentials out of it entirely.
5. Scan .claude/ and transcripts, and treat the scan as a net, not a wall. Point gitleaks or TruffleHog at the .claude/ directory and anywhere transcripts get saved. But of the 1,122 files with a secret, gitleaks flagged 564 and TruffleHog 643, and 215 slipped past both (iTnews). A clean scan is evidence, not proof. It is the same trap as a green test suite written from the code it checks: the check only knows what it was told to look for. It is also worth opening /permissions inside Claude Code now and then and deleting exact rules you no longer need.
6. If anything turns up, rotate first. Deleting the file, or even rewriting history, leaves the secret in every clone, fork and cache that already has it. Apiiro’s advice is to rotate every credential the file ever held before cleaning up, and it is the right order.
Is this a Claude Code bug or a workflow bug?
Both, and pretending it is only one lets the other side off.
On the tool side, Claude Code saves approvals verbatim, in plain text, with no warning when the text looks like a credential. That is a secrets file called a settings file. Checking for a secret before writing a rule is not a hard feature. The reports asking for it are over a year old.
On the workflow side, no tool fix covers teams that commit their local settings or scaffolds that copy them. Nor does it change the fact that an ignore rule on a laptop is invisible to everyone else. All of that was already true of .env files. It became true of agent settings without anyone deciding it should.
The broader pattern is the one from the permission prompt post. Prompts are disappearing, mostly by turning into saved rules, and a saved rule is a file. Every harness that remembers approvals has this exposure in some shape. So does every tool and plugin directory that ends up in a repo. The question to ask of any of them is not “does it ask before acting?” It is “where does it write down that I said yes, and who can read it?”
Frequently Asked Questions
Does deleting settings.local.json fix the leak?
No. The secret stays in git history, and in every clone and fork made while it was there. Rotate the credential first, then untrack the file with git rm --cached, add it to the repo’s .gitignore, and only then decide whether rewriting history is worth the disruption.
Is it safe to commit .claude/settings.json?
Yes, if it holds only rules meant for the whole team and nothing personal. Apiiro found secrets in shared settings.json files too, so review it like any other config file in a pull request. Prefix rules are safe to share. Exact rules deserve a second look.
Do agent transcripts leak secrets as well?
They can. A transcript records the commands the agent ran and often the conversation that led to them, so any credential pasted into a session is in it. Keep transcripts out of the repository, or scan them before they go in.
How do I check my own repositories?
In each repo, git log --all --oneline -- .claude/settings.local.json .claude/settings.json shows whether either file was ever committed. git check-ignore --no-index -v .claude/settings.local.json shows which ignore rule protects the local file. If the answer points into your home directory, add the line to the repo’s .gitignore.
Where it writes the yes
My audit came back clean and still found the problem. That is the useful result. Somebody typed each secret in Apiiro’s 1,122 files. But each file reached git because the protection lived on a laptop instead of in the repository. Two commands will tell you which of your repos are in that state. One line in .gitignore and one CI check fix it for everyone who clones them, including the scaffolding tool nobody thought to ask.
Sources
All accessed 2026-11-10.
- The Hacker News, Claude Code’s “Don’t Ask Again” File Exposes Passwords and Keys in 1,122 Public Copies on GitHub, Nov 2026. https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html
- RuntimeWire, Apiiro finds secrets in 1,122 public Claude Code settings files, Nov 2026. https://runtimewire.com/article/claude-code-dont-ask-again-secrets-public-github-settings-files
- iTWire, Claude Code approval files found exposing company secrets on GitHub, says Apiiro researchers, Nov 2026. https://itwire.com/business-it-news/security/claude-code-approval-files-found-exposing-company-secrets-on-github-says-apirro-researchers
- iTnews, “Don’t ask again” in Anthropic’s Claude Code leaks developer secrets, Nov 2026. https://www.itnews.com.au/news/dont-ask-again-in-anthropics-claude-code-leaks-developer-secrets-630203
- VentureBeat, Did Claude Code’s “don’t ask again” option accidentally expose your enterprise’s passwords and keys?, Nov 2026. https://venturebeat.com/security/did-claude-codes-dont-ask-again-option-accidentally-expose-your-enterprises-passwords-and-keys
- i10x, Apiiro: Claude Code Settings Leak Hit 1,122 Repos, Nov 2026. https://i10x.ai/news/claude-code-settings-local-json-secrets-leak
- Anthropic, Claude Code settings (documentation), quoted sections retrieved 2026-11-10. https://code.claude.com/docs/en/settings
- Apiiro (Shmulik Cohen and Matan Giladi), original write-up, 5 Nov 2026. https://apiiro.com/blog/coding-agents-leaking-secrets-github-dont-ask-again (refused automated access; figures in this post are as reported consistently by iTWire, iTnews, VentureBeat, RuntimeWire, i10x and Let’s Data Science)
- First-party audit: 41
.claude/settings*.jsonfiles and the git history of 25 repositories on the author’s machine, 10 Nov 2026.