Skip to content

AI Compass / News

Claude Code: “Yes, and don't ask again” can store passwords in plain text

Automation Prompting

When you give Claude Code a standing approval for a command, it saves the command word for word, including any password you typed. Apiiro found such secrets in 1,122 public files on GitHub. Here is how to check your projects.

Source: “Don't ask again” in Anthropic's Claude Code leaks developer secrets (iTnews),

Note: I use Claude and Claude Code for my own work. Anthropic does not pay me, and the links are not affiliate links.

Technical drawing: a command containing a password is saved as an allow rule in the file settings.local.json and from there reaches a public repository via git push.Technical drawing: a command containing a password is saved as an allow rule in the file settings.local.json and from there reaches a public repository via git push.

What happened: Claude Code often asks before it runs a command. If you answer “Yes, and don’t ask again”, it saves an allow rule in the file .claude/settings.local.json in your project. Security firm Apiiro has shown that this rule often contains the full command word for word, including any password or key you typed into it. The Hacker News reported on it on 7 November and iTnews on 9 November 2026.

What Apiiro found:

Why the file ends up on GitHub: According to Anthropic’s documentation, the first time Claude Code writes the file it adds it to your machine-wide git excludes, so git leaves it out. That only protects you on that one machine. It does not help with a file you created yourself or one that is already committed. According to The Hacker News, Claude Code does not add the file to the project’s own .gitignore.

What Anthropic says: According to iTnews, Anthropic is looking for a fix. Boris Cherny, head of Claude Code, mentioned two ideas: having auto mode catch such commands, and adding a basic scan for secrets. He said neither might solve the problem completely. No update with a fix has shipped so far. According to The Hacker News, four related bug reports on GitHub were closed by a bot without a reply from Anthropic.

Update 14 November 2026: Since version 2.1.323 of 12 November, if a rule approved with “don’t ask again” looks like a secret or would end up in a settings.local.json that git tracks, Claude Code keeps it for the current session only and no longer saves it (changelog). Files that are already saved are not affected. So the steps under “What you can do” still apply. Also update Claude Code to 2.1.323 or later.

What you can do:

  1. Check whether .claude/settings.local.json in your projects contains passwords, keys or tokens, including in the git history: git log --all -p -- .claude/settings.local.json.
  2. If the file was ever in a repository, rotate every credential it held first. Deleting it is not enough: the secrets stay in the history, in forks and in other people’s clones.
  3. Stop tracking the file (git rm --cached .claude/settings.local.json) and add it to the project’s .gitignore.
  4. Don’t type secrets into commands. Use environment variables, so the rule only stores the variable name.
  5. Approve command patterns such as Bash(npm run test *) rather than single complete commands.

Context: The figures come from Apiiro and were picked up by two trade publications. Apiiro’s own report could not be retrieved at the time of writing, and nobody has checked the figures independently. Cherny says the public copies were probably committed by hand. For you, that changes nothing: if a secret is in the file, replace it.

My workshops show you how to bring AI into your team. See the workshops