Skip to content
AI EmployeeSuper-AgentsAgent-to-AgentBenchmarksPricingBlog

Claude Code's settings.local.json Is Leaking Secrets

At a glanceQuick answers
What did Apiiro find?
That 1,122 public copies of Claude Code’s .claude/settings.local.json hold a real secret, out of 104,185 on GitHub; 2,539 secrets in 1,994 repositories counting history, shared settings and transcripts.
Why does the file hold passwords?
Choosing Yes, and don’t ask again saves the exact approved command as an allow rule. If the command contained a password, the password is saved too.
What should I do?
Rotate every credential the file has held, untrack it, add it to the repository’s .gitignore, and reference secrets as variables instead of typing them.
Editorial data illustration on a near-white ground: a teal file card labeled settings.local.json with a yellow key sliding into a glass case labeled public, beside the numbers 1,122 files with a real secret and 2,539 secrets in 1,994 repos, and an orange stamp reading Yes, and don't ask again
Fig 0A settings file with a key inside, sliding into public view. Made by CellCog's image agent, running GPT Image 2.5.

Claude Code’s “Yes, and don’t ask again” button saves the exact command you approved into a project file, and when that command carries a password, the password is saved too. Apiiro, an application security company, published research on November 5, 2026 counting how often that file reaches public GitHub: 1,122 of 104,185 public copies of .claude/settings.local.json hold a real secret, and the wider count across git history, shared settings and agent transcripts reaches 2,539 secrets in 1,994 repositories.

Anthropic’s documentation says Claude Code keeps the file out of git, and on one computer it does. Apiiro’s numbers show where that protection stops. Below: how a password lands in the file, what was found, what secret scanners miss, and what to do today.

On this page · 9 sectionsOpen
  1. How a password ends up in a settings file
  2. What Apiiro found
  3. What secret scanners miss
  4. It is not one file
  5. What Anthropic has said
  6. What to do today
  7. Where CellCog sits
  8. What we are watching
  9. Sources
Key points6 · 7 min full read
  1. A document with a key beside a magnifying glass.
    Apiiro reported on November 5, 2026 that 1,122 of 104,185 public copies of Claude Code’s .claude/settings.local.json hold a real secret.
  2. A chat prompt with a checkmark and an open padlock.
    Picking Yes, and don’t ask again saves the exact approved command as an allow rule, so a password typed into it is saved in plain text.
  3. A laptop with a shield and a folder drifting away.
    Claude Code adds the file to the user’s global git excludes, but that guard stays on one machine and never reaches the repository’s own .gitignore.
  4. A grid of squares with a few amber ones.
    Across file history, shared settings and agent transcripts, Apiiro counted 2,539 secrets in 1,994 repositories at 63 organizations; one key was confirmed live.
  5. A scanner beam over text with one amber word slipping through.
    Gitleaks and TruffleHog together missed 215 of the 1,122 files, mostly passwords typed inside commands.
  6. Two arrows circling a key.
    Rotate every credential the file ever held first, then untrack it and add it to the repository’s .gitignore.

§ 01How a password ends up in a settings file

Ask Claude Code to check why a staging login fails or to run a migration, and the command it proposes carries the password from your config, because it cannot work without it. Claude Code asks before running a shell command. If you pick “Yes, and don’t ask again”, it runs the command and writes an allow rule into .claude/settings.local.json so it will not ask next time. The rule is the command string itself, secret included.

Animated diagram: a psql command with a masked password is approved with Yes, and don't ask again, slides into .claude/settings.local.json as an allow rule, passes the global git excludes shield around one laptop and lands in a public GitHub box, with 1,122 of 104,185 files holding a real secret
Fig 1One click on Yes, and don't ask again saves the password; the global ignore guards only one laptop

Claude Code’s settings documentation describes the guard: the first time it writes the file in a git repository, “it adds **/.claude/settings.local.json to your global git excludes file, so the file stays out of your commits in every repository.” That guard lives in one person’s git settings on one machine. In Apiiro’s words, “The rule never goes into the repo’s own .gitignore, so nothing travels with the project to protect it.” A folder that becomes a repository later, a clone on another computer, or a file already committed are all outside it.

Often the agent commits the file itself. In 539 of the 1,105 repositories with a real secret that Apiiro traced, a commit co-authored by Claude changed the file. Apiiro reproduced the behavior with Opus 5.5 and Fable 5.1 and puts it plainly: “This is Claude Code’s own behavior, not the model’s“.

§ 02What Apiiro found

Measure Count
Public copies of the file on GitHub 104,185
Repositories holding them 103,617
Files with a real secret 1,122 (1.1%)
Distinct secrets in those files 1,379
Keys in a known provider format 636
Passwords or tokens next to a public host 743
More secrets only in older versions of the file 734, in 509 repos
Forks carrying the same secrets 211 forks of 74 repos
Total across every source Apiiro checked 2,539, in 1,994 repos
Table 1Secrets in public .claude/settings.local.json files (Apiiro, November 5, 2026)
Secret types in the public files, per Apiiro (count)Bar chart of secret types in public Claude Code settings files: database passwords 379 highlighted, Supabase service-role keys 122, Supabase account tokens 103, SSH logins 43, GitHub, GitLab and npm tokens 42, AWS keys 23, private keys 6Database passwords379Supabase service-role keys122Supabase account tokens103SSH logins43GitHub, GitLab, npm tokens42AWS keys23Private keys6Secret types in the public files, per Apiiro (count)Bar chart of secret types in public Claude Code settings files: database passwords 379 highlighted, Supabase service-role keys 122, Supabase account tokens 103, SSH logins 43, GitHub, GitLab and npm tokens 42, AWS keys 23, private keys 6Database passwords379Supabase service-role keys122Supabase account tokens103SSH logins43GitHub, GitLab, npm tokens42AWS keys23Private keys6
Fig 2Secret types in the public files, per Apiiro (count)

More than a third of the secrets open a database directly. Apiiro counted 63 affected organizations, mostly software companies, and the strongest cases include a database vendor’s own admin-level cloud key and the owner password of a medical-records database. It reported each case to its owner on November 2 and 3, and one company confirmed its key had been live. Apiiro did not test any credential: “No credential was used or tested, and no host was contacted.”

The files are not fresh mistakes. Every one sat on its repository’s default branch on November 2, and in the median repository the file had been there 217 days. Bigger files leak more: one in ten files over 8 KB holds a real secret, against fewer than one in 500 under 500 bytes, because each click adds another approved command.

§ 03What secret scanners miss

Apiiro ran gitleaks and TruffleHog over all 104,185 files. Of the 1,122 with a real secret, gitleaks flagged 564 and TruffleHog 643, and 215 were flagged by neither. The misses are mostly passwords typed inside commands, after PGPASSWORD=, sshpass -p or mysql -p, which look like ordinary words to a scanner tuned for key formats. A copy that never reaches GitHub still sits in plain text on the laptop, where credential-stealing malware such as the Shai-Hulud npm worm has already run TruffleHog over victims’ files.

§ 04It is not one file

File Copies checked With a real secret
Shared .claude/settings.json 76,011 298 files
Agent chat transcripts 2,523 120 files in 87 repos
Agent memory files 1,200 9 repos
Handoff and deploy notes 2,095 33 files
VS Code Copilot auto-approve settings 173 9 repos
Table 2Other agent files Apiiro checked for secrets (November 5, 2026)

The pattern spreads wherever an agent records what it ran. On Hugging Face, 126 of 31,053 Spaces hold the same local settings file. Of 16 coding agents whose documentation Apiiro compared, Claude Code is the only one confirmed to write the full approved command to a project file by default. As Apiiro sums it up: “The habit that leaks is the same everywhere: typing a secret into a command that an agent then records.”

§ 05What Anthropic has said

Nothing public yet, as of November 7, 2026, 11:50 UTC. Users have reported the mechanism in GitHub issues since August 2025 (#5544, #11982, #13106, #91270), and Apiiro says “None got a reply from Anthropic”, with three closed automatically as inactive or duplicate. This follows our record of Claude Code sending users’ emails to websites the same week: another case where a default inside the harness, not the model, decides what leaves your machine.

§ 06What to do today

  • Rotate first. Change every password, token and key the file has ever held. Deleting it does not clear git history, forks or clones.
  • Untrack it. Run git rm –cached .claude/settings.local.json and add the file to the repository’s own .gitignore, so the rule travels with the project.
  • Read your local copy. Even if it was never committed, open the file and delete every allow rule that contains a secret.
  • Keep secrets out of commands. Reference them as variables, so the saved rule records $DB_URL and not the password.
  • Approve patterns, not literal commands, such as Bash(npm run:*).
  • For security teams: treat agent folders (.claude/, .cursor/, .gemini/, .specstory/) like .env files, and make sure CI and pre-commit scanning catch passwords inside commands, not only provider key formats.

§ 07Where CellCog sits

Our conflict, declared: CellCog’s agents run on Anthropic’s Claude Opus 5.5, and we use Claude Code to build parts of our product, so this is our problem as much as anyone’s. On CellCog, keys an owner adds on the Keys page reach an AI employee’s scripts as environment variables, which is the habit Apiiro recommends: the command references the variable and the value never appears in it. For the wider principle, see least privilege for AI agents, and for what an agent loose on the internet does with a guessable key, the WorkOS breach.

§ 08What we are watching

  • Anthropic’s response. A Claude Code release that stops saving literal secrets, or that writes the file into the repository’s own .gitignore.
  • Rotation. Whether the 63 organizations rotate and whether GitHub’s own secret scanning starts catching passwords inside commands.
  • Other agents. Whether Cursor, Gemini CLI or Copilot change how they store approvals.

§ 09Sources

Frequently asked5 questions

Q1Is this a bug in the model?

No. Apiiro reproduced it with Opus 5.5 and Fable 5.1 and calls it Claude Code’s own behavior: the harness saves the approved command.

Q2Doesn't Claude Code keep the file out of git?

It adds the file to the user’s global git excludes on that machine. The protection does not travel with the repository, and it does nothing for a file already committed.

Q3Were the secrets used by anyone?

Apiiro did not test any credential or contact any host. One organization it notified confirmed its key had been live.

Q4Do secret scanners catch these?

Partly. Of the 1,122 files, gitleaks flagged 564 and TruffleHog 643; 215 were flagged by neither, mostly passwords inside commands.

Q5Has Anthropic responded?

Not publicly as of November 7, 2026. Apiiro says four related GitHub issues since August 2025 got no reply from Anthropic.

Published 07 November 2026 All Trust, permissions & security →