Contact Open demo
Blog

Secrets in Claude Code's settings.local.json: what to do now

nerl0 TeamSecurity research
News
Secrets in Claude Code's settings.local.json: what to do now

In early November 2026, two security firms published research on the same small file. Apiiro and GitGuardian both found that .claude/settings.local.json, a project file Claude Code uses to remember approved commands, ends up in public GitHub repositories with passwords and API keys inside. GitGuardian also found it in Docker Hub images.

The short answer: when you approve a shell command with 'Yes, and don't ask again', the full command can be saved as an allow rule, and any secret typed into that command is saved with it in plain text. If the file is committed or copied into an image, the secret travels with it. Rotate first, then fix the file.

In this piece, we will cover:

  • How an approval turns into a stored secret
  • What Apiiro and GitGuardian counted, and how the numbers differ
  • What Anthropic has said so far
  • A cleanup order for developers and security teams
  • Where nerl0 fits, and what this does not show

How does a 'don't ask again' approval store a secret?

Claude Code asks before it runs a shell command. One of the answers is 'Yes, and don't ask again'. According to The Hacker News and the Cloud Security Alliance (CSA), that answer writes the approved command into the allow list in .claude/settings.local.json. For an exact-command rule, the stored text is the whole command. If the command carried a password after PGPASSWORD=, mysql -p or sshpass -p, or a token in a curl header, the secret is now in a JSON file in the project folder.

GitGuardian looked at a sample of about 3,000 leaking entries. Half of them were curl commands. Environment variable prefixes such as VAR=value were the next largest group.

The file is meant to stay local. Both The Hacker News and CSA report that Claude Code adds it to the user's global git excludes, not to the repository's own .gitignore. That protection lives on one machine. It does not travel with a clone, a CI job, a package or a container build. GitGuardian adds that Docker's COPY . . copies the working tree and ignores .gitignore, so a .dockerignore entry is needed as well.

What did the researchers find?

There are three separate datasets. They use different methods and should not be added together.

SourceWhat was scannedKey findings
Apiiro, reported by The Hacker News and CSA104,185 public copies of the file in 103,617 GitHub repositories1,122 copies with at least one secret; 1,379 distinct secrets, including 379 database passwords, 43 SSH logins and 23 AWS keys; 2,539 secrets in 1,994 repositories when history, forks and shared settings files are included
GitGuardian, own blog and CSO OnlinePublic GitHub pushes from January 2025 to 7 November 2026, plus Docker Hub images31,088 distinct secrets in settings.local.json across 23,276 repositories; 5,343 valid when detected; 613 distinct secrets in 543 Docker Hub image repositories, 99 of them valid
Check Point, cited by CSAnpm packages428 packages ship the file, 33 of them with credentials

Some details matter for defenders. According to The Hacker News, half of the affected repositories had kept the file on the default branch for at least 217 days. The common scanners gitleaks and TruffleHog each missed part of Apiiro's set, and neither flagged 215 of the 1,122 files, mostly plain passwords after database and SSH flags. Apiiro did not test whether its secrets still worked. GitGuardian did run a read-only validity check and counts its numbers as a floor.

GitGuardian's monthly numbers also show a trend. Occurrences peaked at 12,535 in April 2026 and fell to 959 by October. GitGuardian's researcher Guillaume Valadon says they do not yet know what changed.

The file is not the only one. GitGuardian also found secrets in other agent files, such as CLAUDE.md and Codex's auth.json. According to The Hacker News, Apiiro compared 16 coding agents and Claude Code was the only one confirmed to save the full approved command in a project file by default.

What has Anthropic said?

None of the sources quote an official Anthropic statement or a product change. Cybernews reports that Boris Cherny, head of Claude Code, wrote on Hacker News that the team is looking into ways to prevent this. He said the file is not meant to be checked into source control and that Claude Code ignores it automatically when it creates it, so the exposed copies were likely added by hand. According to CSO Online, citing GitGuardian, he also said built-in secret scanning and an auto mode are being explored.

According to The Hacker News and CSA, earlier GitHub issues about the behavior, the first filed in August 2025, were closed by an automated process without a maintainer reply.

What should you do now?

The sources agree on the order. Rotation comes first, because a removed file does not remove a secret that was already public.

  1. Rotate every credential found in the file. Include the copies in git history, forks and published images. Deleting the file in a new commit does not undo earlier pushes.
  2. Stop tracking the file. Run git rm --cached .claude/settings.local.json and add the path to the repository's own .gitignore. CSA suggests checking the result with git check-ignore -v.
  3. Close the other exits. Add the file to .dockerignore and .npmignore. CSA suggests npm pack --dry-run to see what a package would ship.
  4. Clean the allow list. Delete rules that contain literal secrets. Use environment variables or a secrets manager instead, and approve narrow patterns such as Bash(npm run *) rather than exact commands with values inside.
  5. Treat agent folders as secret-bearing. The researchers name .claude/, .cursor/, .gemini/ and .codex/. Add them to templates, pre-commit hooks and CI scanning, with custom rules for plain passwords that default detectors miss.

Our earlier guide on what credentials a coding agent inherits covers the wider question of which developer credentials an agent can use in the first place.

Why is a leaked agent approval an identity problem?

The secrets in these files are mostly database passwords, cloud keys and service tokens. Each one is a non-human identity: no person logs in with it, but it holds real permissions. Rotation stops the leaked value from working. It does not tell you how far that value could reach while it was live, or whether the identity behind it had more access than the task needed.

That second question is where security teams spend their time after an incident like this. A database password used for one migration may belong to an account that can read every table. A cloud key copied into one test command may sit on a role with access to production storage.

Where nerl0 fits

Finding a secret in a public file is a job for secret scanners, as the sources describe. nerl0 answers the next question. It maps every AI agent and non-human identity and what each can reach. It connects read-only through each platform's own interfaces and reads configuration and permission data, never the contents of data stores.

The Security Graph shows authority paths: agent, credential, role, crown-jewel data store. Every step is an observed relationship. A question like 'which non-human identities can reach our production database?' can be asked of the Agent in plain language. Activated as one of your Questions, it is measured again with every scan.

Issues carry severity, evidence, an owner and a recommended breakpoint. The next scan verifies the fix. For other agent-related events, see the Incident Tracker.

What this does not show

An authority path shows what an identity can reach in configuration. 'Proven' describes the route, not that anyone used it. A path does not show whether a leaked secret was used by someone else, and it does not read what sits inside a data store. Every answer states what it cannot show. More in A route is not proof of use.

Summary

Approving a shell command with 'Yes, and don't ask again' can store the full command, secrets included, in .claude/settings.local.json. Apiiro and GitGuardian found thousands of these secrets in public GitHub repositories, and GitGuardian found more in Docker Hub images. Rotate exposed credentials first, then untrack the file and add it to .gitignore and .dockerignore. Then check what each rotated identity could reach, and narrow it.

Sources

  1. Claude Code's 'Don't Ask Again' File Exposes Passwords and Keys in 1,122 Public Copies on GitHub, The Hacker News, accessed Nov 13, 2026
  2. Approved Once, Leaked Forever: Secrets in Claude Code Settings Files, Cloud Security Alliance, accessed Nov 13, 2026
  3. Claude Code settings.local.json Secrets: 17 months of exposure on GitHub, & Docker Hub, GitGuardian, accessed Nov 13, 2026
  4. Claude Code's 'don't ask again' button has a secrets-spilling problem, CSO Online, accessed Nov 13, 2026
  5. AI agents are leaking their owners' secrets on GitHub: thousands of files exposed, Cybernews, accessed Nov 13, 2026
nerl0 TeamSecurity research

We write about what AI agents and non-human identities can reach, and build nerl0 to keep that visible.

See it on your own data.