Claude Code's "don't ask again" can save the password too. Rotate first, then clean the repo
Clicking "Yes, and don't ask again" in Claude Code feels like a small kindness to yourself. If the command had a password in it, that password is now sitting in a project file, and researchers just found more than a thousand of those files on public GitHub.

When you approve a Claude Code command with "Yes, and don't ask again," the exact command can be saved to .claude/settings.local.json, secrets included. Apiiro found 1,122 public copies holding at least one secret. If your team uses Claude Code, search every repo and its history for that file and .claude/settings.json, rotate anything they ever held, then untrack the file, add it to the repo's .gitignore, and approve patterns instead of literal commands.
What happened
Claude Code asks before it runs most shell commands. One of the answers is "Yes, and don't ask again." Anthropic's own documentation describes what that does: Claude Code saves an allow rule to .claude/settings.local.json at the root of the git repository, and matching commands run without asking in later sessions, anywhere in that repo.
Sometimes the saved rule is a pattern, like npm test *. Sometimes it's the exact command that was on screen. If that command had a database password or an API token typed into it, the secret is saved too, in plain text.
On November 5, the security company Apiiro published research on what happens next, as reported by The Hacker News on November 7. Searching public GitHub, it found 104,185 copies of that file across 103,617 repositories. In 1,122 of them, about 1.1 percent, there was at least one secret, adding up to 1,379 distinct secrets. More than a third opened a database directly. The list included 379 database passwords, 43 SSH logins for public servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. Apiiro says it didn't test whether they still work. One company it notified confirmed its key had been live.
Older versions of the file, sitting in git history after someone deleted it, held 734 more. Forks carried copies of the originals.
Why the safeguard didn't hold
Claude Code does try to keep the file out of git. The first time it writes the file in a repository that doesn't already ignore it, it adds the path to your global git excludes. That's a setting on one person's computer.
It doesn't travel with the project. A teammate who clones the repo on a new laptop, a CI job, a folder that becomes a repository later, or a file that was already committed before the exclude existed, all slip past it. Apiiro also found that in 539 of the 1,105 repositories it traced, the commit that changed the file listed Claude as a co-author. The agent was committing its own permissions file.
And the usual safety net has holes. Apiiro ran gitleaks and TruffleHog over every file that had a secret. Of the 1,122, gitleaks flagged 564 and TruffleHog 643. Neither flagged 215. Most of the misses were passwords typed into commands, because scanners look for known key formats, and a password after sshpass -p looks like an ordinary word.
The settings file is not unusual here. It's a plain JSON file in the project folder, and it can end up in an npm package, a Docker image, a zip sent to a contractor or a synced drive, as easily as in a commit.
Deleting the file is the last step, not the first. The secret was public the moment it was pushed.
Rotate first
The instinct is to delete the file and push. That feels like fixing it. It isn't.
Deleting the file is the last step, not the first. The secret was public the moment it was pushed.
Start by searching. Look in every repository your organization owns, public and private, for .claude/settings.local.json and the shared .claude/settings.json, which Apiiro also found secrets in. Check git history, not just the current branch, because a deleted file is still readable in older commits and in any fork made before you deleted it.
Make a list of every password, token and key those files have ever contained, and the system each one opens. Rotate them all. Start with credentials that sit next to the address of a public server, such as a database host or an SSH target, because those give someone access right away. After each rotation, confirm the old value no longer works.
Only then clean up: run git rm --cached .claude/settings.local.json, add it to the repository's own .gitignore, and open the local file on every developer's machine to remove rules that contain secrets. Rewriting history is optional once the secrets are dead. It's not a substitute for killing them.
How the work moves
The order that actually closes the leak
- Find
Search every repo, including history and forks, for .claude/settings.local.json and .claude/settings.json.
- List
Write down every password, token and key the files ever held, with the system each one opens.
- Rotate
Change each one, starting with credentials paired with a public host. Confirm the old value fails.
- Untrack
git rm --cached the local file and add it to the repository's own .gitignore.
- Prevent
Approve patterns, keep secrets in variables, and scan agent folders in CI.
Stop it happening again
The fix is mostly habit.
Keep secrets out of commands. Refer to them as variables from a secrets manager, like $DB_URL. If a saved rule ever leaks, it leaks a variable name.
Approve patterns, not commands. Bash(npm run:*) is a reasonable standing approval. A full psql connection string is not. When the prompt offers only the literal command, say yes once and leave "don't ask again" alone.
Treat agent folders like .env. Apiiro's advice to security teams is to handle .claude/, .cursor/, .gemini/ and .specstory/ folders, and agent memory files, as places secrets live. Add them to your organization's .gitignore templates and to pre-commit and CI secret scanning, and make sure the scanner looks for passwords inside commands, not only provider key formats.
If you haven't written down how your team rotates credentials, now is a good week to. We wrote about rotating credentials like a cutover.
Decision guide
What a standing approval saves
| Consideration | Approve a pattern | Approve a literal command |
|---|---|---|
| Saved rule | Bash(npm run:*) | The full command, password and host included |
| Secrets | Referenced as $DB_URL from a secrets manager | Typed inline after PGPASSWORD= or mysql -p |
| Where it travels | Nowhere worth stealing | Commits, forks, zip files, Docker images, synced folders |
| Scanner coverage | Nothing to find | Passwords in commands often missed by format-based scanners |
Decide what your team allows
This is a tooling issue and a policy one. Someone on your team should own the answer to a simple question: which commands may an AI coding agent run without asking, and who reviews that list?
A short page will do. Approved patterns per repository. A rule that secrets never appear in a command line. A monthly look at each developer's local settings file. And a note in onboarding, because the person most likely to click "don't ask again" on a password is the newest one, in a hurry, on their first week.
If you don't write code yourself but you pay people who do, including an agency or a freelancer, ask them three plain questions this week. Do you use Claude Code or another coding agent on our repositories? Have you searched our repos and their history for agent settings files? And if anything turned up, which credentials did you rotate, and when? A good partner will have answers ready, and won't mind being asked. A vague answer is your signal to ask for the search to be done while you watch.
If you're putting coding agents into a real product team and want the repo hygiene, CI scanning and permissions to keep up, that's part of our web application engineering work. Get in touch.
Related work: Spin:Market
We build alongside the people doing the work.
Bring us the problem you’re thinking about.