# 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.

- Published: 2026-11-08
- Publisher: Rig Labs (https://riglabs.ai/)
- Canonical: https://riglabs.ai/blog/claude-code-settings-local-json-secrets/
- Answers: claude code settings.local.json secrets
- Agent file (a short card for your agent): 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](https://code.claude.com/docs/en/settings) 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](https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html):

| 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](https://code.claude.com/docs/en/settings) 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:

1. See if the file is tracked: `git ls-files | grep settings.local.json`
2. See if it was ever committed, even if it is gone now: `git log --all --oneline -- '*.claude/settings.local.json'`
3. 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:

1. 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.
2. Stop tracking the file: `git rm --cached .claude/settings.local.json`
3. Add `.claude/settings.local.json` to the project's own `.gitignore`, so it stays out for every clone.
4. 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:
- [The Hacker News: Claude Code's "Don't Ask Again" file exposes passwords and keys](https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html), 2026-11-07
- [Apiiro's research post](https://apiiro.com/blog/coding-agents-leaking-secrets-github-dont-ask-again)
- [Claude Code settings docs](https://code.claude.com/docs/en/settings)
