Claude Code's local settings files are leaking passwords into public GitHub repos
Security firm Apiiro found Claude Code settings files in public repositories exposing database passwords and API tokens. Here is how it happens and how to check your own.
The short version
- Apiiro found the leak on November 9: database passwords, API tokens and root logins in public GitHub repos.
- Approving a command with the 'don't ask again' option can save the full command, secrets included, to a local file.
- About 1100 files, from 63 organizations, contained secrets; 215 of those slipped past gitleaks and TruffleHog.
- Deleting the file may not help, because copies of the project can keep the secrets.
- Anthropic's Boris Cherny says the team is studying a fix and may build in secret scanning.
Why it matters
If you use Claude Code, a password you typed into an approved command may now sit in a plain-text file in your project folder. If that folder ever reaches a public repository, anyone can read it. The fix for you is a few minutes of checking and, where needed, replacing keys.
What Apiiro found
As sspai.com reported in its Pai Morning Brief, the AI security company Apiiro found that Claude Code settings files are exposing sensitive data in public GitHub repositories. The exposed material includes database passwords, API tokens (strings that let software log in to a service) and root login details, which give full control of a server.
Apiiro found a very large pile of these files, well over a hundred thousand, uploaded to public repositories. Of those, about 1100 files from 63 organizations contained actual secrets.
How a password ends up in a settings file
Claude Code is Anthropic's coding assistant. When it wants to run a command in your terminal, it asks permission. If you choose the option that says yes and stop asking, that approval is saved as a rule in a local file called .claude/settings.local.json.
Sometimes the rule is stored as a general pattern. Often, though, the exact command is copied in word for word. If the command had a password or token typed into it, that secret is now written down in plain text.
Anthropic's documentation says this file is added to the developer's global .gitignore, a list that tells Git, the code-tracking tool, which files to skip. But that list lives on one person's machine, not in the repository. So if the project is copied to another computer, or a folder becomes a repository only later, the file can get uploaded by mistake.
Apiiro also said that in many cases Claude Code commits changes to this file by itself, with no human step in between. A commit is a saved snapshot of the code.
Why scanners and deletion don't fully solve it
Many teams run secret scanners, tools that search code for leaked keys. Apiiro found that 215 of the exposed secrets were not caught by two common ones, gitleaks and TruffleHog. A clean scan is therefore not proof that nothing leaked.
Deleting the file afterwards also may not be enough. Apiiro noted that secrets can remain in forks, which are copies of the project made by other people. The safe assumption is that an exposed key is already compromised.
The problem is not new. People raised it in Claude Code bug reports as early as August 2025, and those reports were closed after 60 days without activity.
What Anthropic says
Boris Cherny, who works on Claude Code, replied on Hacker News. He said the team is looking at ways to prevent the problem. He also argued that these settings files should basically never be committed to a Git repository, and that the cases he has seen involved a file that someone created by hand and committed.
He recommended using auto mode and a secret scanner. He added that the team is considering building secret scanning into Claude Code itself. That is a possibility, not a shipped feature.
What you can do now
This kind of leak is cheap to check for and expensive to ignore. A short routine covers most of the risk:
- Open the .claude/settings.local.json file in each project and look for passwords, tokens or keys inside saved commands.
- Check that the file is excluded in each repository's own .gitignore, not only on your machine.
- Search your repository history, not just the current files, for anything that was committed earlier.
- Replace any key you think was exposed. Rotating a key means issuing a new one and disabling the old.
- Stop typing secrets directly into commands. Use environment variables or a secrets manager instead.
If you work on a team, pass this along. The person most likely to leak a key is the one who never opens this file.
What to watch
- Whether Anthropic ships a fix, such as built-in secret scanning, and how it handles the file's default behavior.
- Whether secret-scanning tools update to catch the 215 secrets that slipped past them.
Try it
Open .claude/settings.local.json in your active projects, look for passwords or tokens inside saved commands, and replace any key you find. Then check that the file is in each repo's own .gitignore.
Sources and links
- Reportingsspai.com: the article we sourced
First reported by sspai.com. Written by the SI Agent News Desk from the reporting above.Written with AI from the source above. Every number is checked against the source. Spot a mistake? Corrections.
Liked it? Say why
Add a line for other readers.
No account needed. We never show your email. Comments with links, ads or abuse are held and not shown. Your comment shows after a quick check.