
Key takeaways
- The main leak is one small file. When you approve a command in Claude Code with "Yes, and don't ask again", the exact command is saved as a rule in
.claude/settings.local.json. If the command contained a password, the password is saved too. - Apiiro found 104,185 public copies of that file on GitHub, and 1,122 of them held a real secret (a known key format, or a password next to a public server; Apiiro did not test whether they still work). Adding git history, shared settings files and agent transcripts, the total was 2,539 distinct secrets in 1,994 repositories.
- More than a third of the secrets in the file open a database directly: 379 database passwords and 122 Supabase service-role keys. Another 103 were Supabase account tokens, which Apiiro says control every project in the account.
- Deleting the file does not fix it. Git history, forks and clones keep the old copy. Rotate every credential the file ever held first, then clean up.
- Scanners miss part of it. 215 of the 1,122 files with a real secret were flagged by neither gitleaks nor TruffleHog. Open the file and read it.
Our method: figures come from Apiiro's report (published November 5, 2026, updated November 8), read on November 13, 2026. Anthropic's response is quoted from Boris Cherny's comments in the Hacker News discussion on November 7. Product behavior comes from the Claude Code settings documentation and Apiiro's report, and the clean-up steps from GitHub's documentation. Apiiro is a security company and we sell app security fixes, so both sides have an interest in this topic. We have tried to stick to what the sources say. "Real secret" in Apiiro's report means a credential in a known provider format or one paired with a public host. Apiiro did not test whether the credentials still work.
What Apiiro found
Apiiro searched public GitHub between November 1 and 3, 2026. It listed every copy of Claude Code's local settings file it could find and downloaded each one.
| What | Number |
|---|---|
Public copies of .claude/settings.local.json | 104,185, in 103,617 repositories |
| Copies holding a real secret | 1,122 (1.1%), with 1,379 distinct secrets |
| Secrets found only in older versions of the file | 734, in 509 repositories |
| Total across the file, its history, shared settings and agent transcripts | 2,539 distinct secrets in 1,994 repositories |
| Organizations affected | 63, from student groups to startups, software agencies and established vendors |
| Forks carrying the same secrets | 211 forks of 74 repositories |
Most of the secrets belong to individual developers. Among the organization cases Apiiro lists: a production Azure Postgres password at a B2B startup, a Square production access token at a software agency, and the owner password for the cloud database of a medical-records app. Apiiro also found 43 SSH logins for public servers, some of them root passwords.
The files were not new. In the median repository with a real secret, the file had first been committed 217 days before November 2. In 118 repositories it had been committed more than a year earlier. Apiiro says one organization confirmed its key had been live.
How a password ends up in a settings file
An AI coding agent like Claude Code runs commands on the developer's computer. Ask it why login fails on staging, or to run a database migration, and the command it proposes can include a password or key, because the command can't work without it. Claude Code asks before running a shell command. The Claude Code documentation describes what happens next: if you choose "Yes, and don't ask again", Claude Code "saves that approval as an allow rule in .claude/settings.local.json". Apiiro's point is that the rule is the command string itself, so whatever was typed into the command is saved with it.
The file is meant to stay on the developer's machine. The documentation says that the first time Claude Code writes the file in a git repository that doesn't already ignore it, it adds the file to the developer's global git ignore list. Apiiro says that covers the common case but not a folder that becomes a repository later, a clone on another machine, or a file someone already committed. The rule goes into the developer's own git settings, not the project's .gitignore, so nothing travels with the project.
Apiiro says Claude often commits the file itself: in 539 of the 1,105 repositories with a real secret that it traced, a commit co-authored by Claude changed the file. Anthropic sees it differently (see below). Apiiro also notes that users had reported this behavior in Claude Code GitHub issues since August 2025.
Bigger files were far riskier. One in ten files over 8 KB held a real secret, against fewer than one in 500 under 500 bytes. Apiiro links file size to how long someone has been clicking "don't ask again".
It isn't only one file or one tool
Apiiro compared how 16 coding agents store approvals, based on their documentation, and says Claude Code is the only one confirmed to write the full approved command to a project file by default. But it found secrets in other files that agents write and developers commit:
| File | Checked | With a real secret |
|---|---|---|
Shared .claude/settings.json (committed on purpose) | 76,011 | 298 files |
| Agent chat transcripts (.specstory, aider, Cursor exports) | 2,523 | 120 files in 87 repos |
| Agent memory files (MEMORY.md and similar) | 1,200 | 9 repos |
| Handoff and deploy notes | 2,095 | 33 files |
| VS Code Copilot auto-approve settings | 173 | 9 repos |
Apiiro found the transcripts, memory files, handoff notes and Copilot settings by searching for key formats and connection strings, so those counts are not leak rates. The shared settings.json row covers every public copy. The habit behind all of them is the same: a secret typed into a command that an agent then records somewhere.
What Anthropic said
Apiiro says it shared the research with Anthropic before publishing. On November 7, Boris Cherny of the Claude Code team replied in the Hacker News discussion: "Historically Claude Code has not done secret scrubbing (there are many good tools for that), but we are looking into what we can do to prevent this." He said the file "is meant to stay local" and is gitignored automatically when Claude creates it, so in his view the exposed copies were created manually and checked in. He named possible fixes the team would prototype: "making sure auto mode catches this, building in basic secret scanning, a few other ideas." He recommended auto mode over manual permission rules. When a reader pointed out that the same thing can happen in auto mode when it asks about a sensitive command, he replied "Yeah good catch." According to Apiiro, he also recommended turning on the secret scanning that GitHub and other hosts offer.
Whatever ships next, files that are already public stay public. If your project has the file in its history, the fix is on your side.
How to check your app: a 5-step check
If someone else built your app, send them this list. If you built it yourself, run the commands from the project folder.
- Is the file in the repository now? Run
git ls-files | grep -E '(^|/)\.claude/'. Any line that ends insettings.local.jsonmeans the file is tracked and gets committed with everything else. - Was it ever committed? Run
git log --all --oneline -- '*.claude/settings.local.json'. Any output means the file is in history, even if it's gone today. If the repository is public, so is every version in that history. - What's in it? Find every copy on the developer's computer with
find ~ -path '*/.claude/settings.local.json' 2>/dev/nulland read theallowlist. Look for passwords, tokens, API keys and connection strings, especially afterPGPASSWORD=,mysql -p,sshpass -por anAuthorization: Bearerheader. - Check the other agent files. Look through
.claude/settings.json,.cursor/,.gemini/,.specstory/, exported chats, memory files and handoff notes in the repository for the same things. - Turn on secret scanning. GitHub's documentation says that for public repositories "Secret scanning runs automatically for free"; for private repositories owned by an organization it requires GitHub Secret Protection on GitHub Team or Enterprise Cloud. Then look at the alerts it raises (GitHub lists them under the repository's Security and quality tab). Remember that scanners look for key formats and miss many plain passwords, which is why step 3 matters.
Found a secret? Rotate first, clean up second
GitHub's documentation is direct about the order. If the leaked data is a password, token or credential, the first step is to revoke or rotate it. Once it's rotated it can no longer be used, and GitHub says that may be enough. Rewriting history to remove it is "time-intensive and often unnecessary if you've already revoked the credential".
- Rotate every credential the file has ever held, not just what's in it today. Change the database password, revoke and reissue the API key, replace the SSH password with a key. Start with anything that opens something directly: database passwords next to a server address, Supabase service-role keys, and payment and cloud keys.
- Check for misuse. Look at the provider's access logs and billing for the period the secret was public, where the provider offers them.
- Untrack the file and ignore it in the project. Run
git rm --cached .claude/settings.local.jsonand add.claude/settings.local.jsonto the repository's own.gitignore. - Delete every rule with a secret from the local file, even if it was never committed.
- Only then decide about history. GitHub's guide uses
git-filter-repo --sensitive-data-removal(version 2.47 or later) and lists the costs: commit hashes change, collaborators who pull and push can bring the data back, open pull requests should be merged or closed first, and copies in forks and other people's clones stay where they are.
How to stop it happening again
- Keep secrets out of commands. Store them in environment variables or a secrets manager and reference them as
$DB_URL. Then the saved rule records$DB_URL, not the password. - Approve patterns, not literal commands. Apiiro suggests rules such as
Bash(npm run:*)instead of a full command line. - Add agent folders to the project's
.gitignore, starting with.claude/settings.local.json, so the protection travels with the repository to every machine. - Scan before every commit. GitHub recommends a pre-commit hook (it names git-secrets and gitleaks), avoiding
git add ., and reviewing staged changes withgit diff --cached. Apiiro adds: make sure the scanner catches passwords inside commands, not only provider key formats. - Keep GitHub push protection on. GitHub's guide recommends enabling it to detect and prevent pushes that contain hardcoded secrets.
- Treat agent files like
.env. They don't only leak through git. Apiiro notes the file can leave in a published npm package, a Docker image, a zip archive or a synced folder, and that malware already searches developer machines for credentials.
If a freelancer or agency built your app
You may never have opened the repository, but the database and payment keys are yours. Ask your developer three questions in writing:
- Did you use an AI coding agent on this project, and have you checked its files (steps 1 to 4 above) in the repository and on your machine?
- Which credentials have you used in commands while working on it, and have they been rotated since?
- Who has a copy of the code: which repositories, forks and computers?
These are routine questions. If the project has changed hands or the developer is gone, assume the secrets need rotating and plan a handover. Our 12-step checklist for AI-built apps covers the rest: database access rules, payments, backups and monitoring.
FAQ
Is deleting .claude/settings.local.json enough?
No. If the file was ever committed, the secrets stay in git history, in forks and in other people's clones. Apiiro found 734 real secrets that appear only in earlier versions of the file. GitHub's guidance is to revoke or rotate the secret first. Cleaning history is optional after that.
My repository is private. Am I safe?
Safer, not safe. Apiiro's numbers cover public repositories only. A private repo still shares the file with everyone who has access, and the file can leave in a published package, a Docker image, a zip archive or a synced folder. The file also sits in plain text on the developer's machine, where malware that searches for credentials can read it.
Does a secret scanner catch this?
Partly. Apiiro ran gitleaks and TruffleHog over all 104,185 files. Of the 1,122 files with a real secret, gitleaks flagged 564, TruffleHog 643, and 215 were flagged by neither. Scanners look for known key formats and often miss a plain password typed into a command. Read the file yourself as well.
Is this only a Claude Code problem?
Claude Code's approval file is the largest case Apiiro found, and Apiiro says Claude Code is the only one of 16 coding agents confirmed to write the full approved command to a project file by default. But it also found real secrets in agent chat transcripts, agent memory files, handoff notes and VS Code Copilot auto-approve settings.
Planning the app's next stage? See what it costs to build an app in 2026 and what happens if you stop updating it.
Built your app with AI? Get it checked before someone else does.
Tell us what your app does and where the code lives. We reply within one business day and send a fixed written quote. Our AI App Rescue starts from $990 and covers a security audit of logins, database rules and API keys, bug fixes and a safe production launch for apps built with AI tools such as Lovable, Bolt, Replit or Cursor.
Sources
- Apiiro: Coding agents are leaking your secrets to GitHub (November 5, 2026, updated November 8)
- Hacker News discussion with comments by Boris Cherny, Claude Code team (November 7, 2026)
- Claude Code documentation: Settings
- Claude Code GitHub issue #5544 (one of the earlier user reports Apiiro cites)
- GitHub Docs: About secret scanning
- GitHub Docs: Removing sensitive data from a repository