Security warning: secrets leak via Claude Code's settings.local.json
Approving a command in Claude Code with 'Yes, and don't ask again' saves it verbatim to .claude/settings.local.json, including any password or API key in it. Claude Code adds the file to the global gitignore, but that misses already-tracked files…
Why it matters
Every Claude Code user should check this file today and rotate anything that leaked.
What happened
1 min readApproving a command in Claude Code with 'Yes, and don't ask again' saves it verbatim to .claude/settings.local.json, including any password or API key in it. Claude Code adds the file to the global gitignore, but that misses already-tracked files, later-initialized repos and teammates' clones. An Apiiro scan reportedly found secrets, including database passwords, GitHub and npm tokens and AWS keys, in 1,122 public copies on GitHub.
Our analysis
This is not a bug in the tool so much as verbatim allow-rules meeting the habit of putting secrets on the command line, much like shell history. Fix: list the rules with jq, untrack the file with git rm --cached, add it to .gitignore, and rotate anything pushed, since scrubbing history is not enough. The source is a Reddit post citing Apiiro rather than the original report, so treat the 1,122 figure accordingly. Better still, pass secrets via environment variables, not inline in commands.