Claude Code settings.local.json Secrets: Check Yours
Security firm Apiiro reported public repos with secrets inside Claude Code's local approval file. Here is how the file works, what was reported, and a short checklist to check your own repos today.
By Mutahar Aslam, Founder & CEO of Paraline Tech5 min read

You use Claude Code, you click "Yes, and don't ask again" a few times a day, and you push your work to GitHub. Somewhere in that loop, a file called .claude/settings.local.json may have gone public with a password inside it. This post explains how the Claude Code settings.local.json file works, what researchers reported in early November 2026, and how to check your own repos in about ten minutes.
What the file does
When Claude Code wants to run a Bash command, it asks first. If you choose "Yes, and don't ask again", the tool remembers your answer. According to Anthropic's settings docs, "Claude Code saves that permission approval here as an allow rule" in .claude/settings.local.json.
That is a sensible design. You should not have to approve npm test forty times. The risk comes from what a rule can contain. A rule can hold the whole command. If you approved a command with a password, token or key typed into it, that value can end up in the file as plain text.
To be clear, this does not happen with every approval. A secret is only saved if it was typed into the command you approved.
What the docs say about git
The docs, as read on 8 November 2026, say Claude Code adds **/.claude/settings.local.json to your global git excludes when it first writes the file. They also say that if you create the file by hand, you should "add it to .gitignore yourself".
Notice the word "global". A global exclude is a setting on one computer. It is not part of your repository. It does not travel to a teammate's laptop, a CI runner or a fresh clone. Both The Hacker News and iTWire make this point in their coverage. It is also how git ignore rules behave: they do not apply to files that are already tracked.
What Apiiro reported
Security firm Apiiro published research on the topic in early November 2026. We could not open Apiiro's own report, so the figures below come from The Hacker News and iTWire, which agree with each other on the main numbers. Treat them as Apiiro's findings, not ours. They describe the data at the time of Apiiro's scan, which ran from 1 to 3 November.
- Apiiro looked at 104,185 public copies of
.claude/settings.local.json. Of these, 1,122 (about 1.1%) held at least one secret, 1,379 distinct secrets in total. - Counting older versions, shared
settings.jsonfiles and saved agent chat logs, Apiiro counted 2,539 secrets across 1,994 repos. - According to The Hacker News, the secrets included 379 database passwords, 43 SSH logins, 42 GitHub, GitLab or npm tokens, and 23 AWS keys, across 63 organizations.
- Apiiro notified affected organizations on 2 and 3 November. One company confirmed that its key was live. Apiiro did not test whether the other credentials still work.
So the number is small as a share of files, and large in absolute terms. We cannot say how many of those credentials are still valid, or whether anyone used them.
The docs say the file is git-excluded, yet Apiiro found over a thousand copies with secrets in public repos. We are not going to guess why. The reports do not establish a cause, and there are several possible ones. The practical lesson is the same either way: do not rely on a setting you cannot see in the repository.
Earlier reports and Anthropic's response
This was not unknown. A GitHub issue opened on 19 November 2025 reported that Claude Code created the file without adding it to .gitignore. The reporter said it still reproduced on later versions. A stale bot closed it as "not planned" on 5 March 2026, with no maintainer comment. A second issue came from a user who pushed the file to a public repo and received a secret-scanning alert. It was closed as a duplicate of the first.
The Hacker News also describes an August 2025 report that was auto-closed, and says related reports got no reply. Apiiro and The Hacker News report no response from Anthropic. As of 8 November 2026, we found no Anthropic statement and no changelog entry about settings.local.json or git excludes (we checked up to version 2.1.319). That is absence of evidence, not proof, so check the changelog yourself.
Check your repos for Claude Code settings.local.json
Here is the checklist we would follow. This is Paraline's general advice, not something taken from the reports.
-
Search your working copy. From each repo root, run:
git ls-files | grep -E '\.claude/settings(\.local)?\.json$'Any output means the file is tracked by git.
-
Search your history. The file may have been committed and removed later:
git log --all --oneline -- .claude/settings.local.json -
Read the allow rules. Open the file and look for passwords, tokens, keys and connection strings inside commands.
-
Rotate first. If you find a secret, replace the credential before anything else. Deleting the file does not clear git history, forks or clones.
-
Then stop tracking the file. Add this line to your project
.gitignore, then untrack the file:echo ".claude/settings.local.json" >> .gitignore git rm --cached .claude/settings.local.json git commit -m "Stop tracking local Claude Code settings" -
Check other agent folders. Other coding tools keep local files too. Look at what they store and whether those files are ignored. We are not saying they have the same problem, only that they deserve the same five-minute look.
-
Turn on secret scanning. Enable GitHub's secret scanning and push protection, or run a scanner in CI. Scanners are not perfect: according to The Hacker News, Gitleaks flagged 564 of the 1,122 files, TruffleHog flagged 643, and neither flagged 215. Use two layers, not one.
Stop secrets reaching the command line
The better fix is to never type a secret into a command. Read credentials from environment variables or a secrets manager, and approve the command that reads them, not the one that contains them. For example, run a database tool with PGPASSWORD already set in your shell profile or a git-ignored .env file, rather than pasting the password into the command you approve.
Before you click "don't ask again", read the command once. If it contains something you would not paste into a public chat, choose "Yes" for this single run instead.
What to do next
- Run the two git commands above in every repo where you have used Claude Code.
- Rotate any credential you find, then add the
.gitignoreline. - Turn on secret scanning for your organization.
- Re-check the changelog and docs in a few weeks, since Anthropic may respond.
If you would like a second pair of eyes on your repos, CI checks or AI-assisted workflow, get in touch with Paraline Tech.
Common questions
Does every Claude Code approval save a secret?
No. A secret only lands in the file if it was typed into a command you approved, for example a password in a connection string. Commands without secrets save no secrets.
Is the file ignored by git automatically?
The docs say Claude Code adds it to your global git excludes on first write. That setting lives on one machine, so it does not protect other machines, other contributors or files already committed. A project .gitignore entry does.
Were the leaked credentials abused?
We do not know. Apiiro did not test whether the credentials still work. As reported, one company confirmed that its key was live.
Keep reading
Claude Code Extension Backdoor in Cursor: What to Do
A fake Anthropic.claude-code extension was served from Cursor's marketplace on 29 October 2026. Here is who is affected, how to check your machine, and what to do next.
6 min read
LiteLLM Vulnerability in CISA KEV: What to Patch Now
CISA added a LiteLLM flaw, CVE-2026-40217, to its Known Exploited Vulnerabilities list on 18 November 2026. Here is what it is, who is affected, and a short checklist.
5 min read
Google Workspace MCP Becomes Mandatory for AI Agents
Google now says AI agents that touch Workspace must use its MCP servers or its CLI. Here is what changes on 1 Feb and 1 Apr 2027, and how to check your agent against the new daily cap.
5 min read


