Claude Code Secrets Leak: What 1,122 Public Settings Files Mean for Your App
If your app was built with Claude Code, by you, a staff member or a freelancer, there’s one small file worth checking this week. Security researchers at Apiiro found real passwords and keys sitting in public copies of it on GitHub, and the way they got there is a single click most people make without thinking.
This Claude Code secrets leak didn’t need an attacker to break anything. The secrets were simply published along with the code. Here’s what was found, why it matters, and what to ask.
What the researchers found
Apiiro looked at 104,185 public copies of a Claude Code settings file, .claude/settings.local.json, across 103,617 GitHub repositories. 1,122 of those copies held at least one real secret. Among them were 379 database passwords and 122 Supabase service-role keys. Counting older versions and related files, the researchers found 2,539 secrets across 1,994 repositories.
How one click puts a password in a file
When Claude Code wants to run a command, it asks for approval. One of the options is “Yes, and don’t ask again.” Choose it, and Claude Code can save that exact command as a permanent rule in .claude/settings.local.json. If the command contained a password or token, for example a database connection string pasted in to get something working, the saved rule contains it too, in plain text.
The file is meant to stay on the developer’s computer. According to The Hacker News, Claude Code adds it to the user’s own global git exclusions, but not to the project’s .gitignore, so the project itself has no protection against committing it. The researchers say earlier bug reports about this behavior were closed automatically, and no fix had been announced at the time of reporting.
Why it matters to a business owner
A database password or a Supabase service-role key is not a small secret. The service-role key bypasses row-level security, the rules that decide who can see which rows in a Supabase database. We explained why those rules matter in our guide to checking whether a Lovable app is leaking data. Anyone holding that key can read and change everything.
Leaked keys are also found fast. In our risk report for the week of Nov 2 we covered Microsoft’s account of attackers using AI agents to search GitHub for secrets, with one case taking five minutes from search to stolen data. And a key keeps working until someone replaces it, even after the file is deleted.
Does my Claude Code project leak secrets?
Ask whoever builds or maintains your app to check three things:
- Is
.claude/settings.local.jsonlisted in the project’s.gitignore? If not, add it. - Has that file ever been committed? Check the repository’s history, not just the current files. A secret that was pushed once is still in the history.
- Does any Claude Code settings file contain a password, key or token? Look for connection strings, payment keys, service-role keys and anything that looks like a password.
The safe fix
If a secret was ever pushed, the order matters:
- Replace the key first. Create a new key or password at the provider, update the app, redeploy, then switch the old one off. Our step-by-step guide to rotating API keys covers the order so the app doesn’t go down.
- Then clean up. Remove the file from the repository and add it to
.gitignore. Deleting the file without replacing the key doesn’t help: the old key still works for anyone who copied it. - Change the habit. Keep secrets in the hosting platform’s secret settings and refer to them by name in commands, rather than pasting the value. When approving a command for good, approve a general pattern such as “run the tests”, not a one-off command that contains a password.
What to ask this week
- Do we use Claude Code, or does anyone who works on our app?
- Is its local settings file in our
.gitignore, and has it ever been committed? - If it was, which keys were in it, and have they been replaced?
- Where do our app’s secrets live, and who replaces them when someone leaves?
None of this needs a rebuild. If you’d like a second pair of eyes, our free Forward Scan looks at an AI-built app’s three biggest risks, including where its keys live.
Sources
- The Hacker News, Claude Code “don’t ask again” file exposes secrets (Nov 7, 2026): https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html
- RuntimeWire (Nov 7, 2026): https://runtimewire.com/article/claude-code-dont-ask-again-secrets-github-apiiro
- PrivacyAffairs (Nov 8, 2026): https://www.privacyaffairs.com/claude-code-dont-ask-again-secrets/
- Apiiro research: https://apiiro.com/blog/coding-agents-leaking-secrets-github-dont-ask-again