Security Digest · Nov 5, 2026 · Misconfiguration · AI agent tooling

Claude Code: Approved Commands Leak Secrets to Public Repos

Apiiro found secrets in 1,122 public .claude/settings.local.json files saved by 'don't ask again'. Search your repos, rotate what you find, then untrack it.

Our verdict

Check exposure

Nothing here attacks your machine, but if a .claude/settings.local.json file was ever committed to a repository others can read, assume any password or token in it is exposed and rotate it.

Who must act: Teams using Claude Code whose repositories, especially public ones or forks, have ever tracked .claude/settings.local.json or put literal credentials in .claude/settings.json.

Who can relax: Developers whose settings.local.json has never been committed, which is the default when Claude Code creates the file, and whose approved commands contain no literal secrets.

Affected
Claude Code projects with .claude/settings.local.json committed to git (version range not disclosed as of 2026-11-09)
Fixed in
No fix listed
CVSS
Not scored
EPSS
n/a
CISA KEV
Not listed
Exploitation
No known exploitation
Severity
High

What to do

  1. Search your organization for committed copies with gh search code permissions --owner YOUR_ORG --filename settings.local.json, then repeat for settings.json.
  2. Rotate every password, token and key found in those files or their git history before you clean anything up.
  3. Untrack the file with git rm --cached .claude/settings.local.json and add it to the repository's .gitignore.
  4. Remove literal secrets from allow rules in local copies, and pass credentials through environment variables or a secrets manager.
  5. Prefer prefix rules such as Bash(npm run *) over approving one-off commands that contain credentials.
  6. Treat agent folders such as .claude/, .cursor/, .gemini/ and .specstory/ as secret-bearing, like .env files, in reviews and scanner configuration.

How to check if you are affected or compromised

  • List tracked agent files: git ls-files | grep -E '(^|/)\.claude/'.
  • Check history on all branches: git log --all --oneline -- .claude/settings.local.json.
  • Search for passwords typed into commands: grep -nE 'PGPASSWORD=|sshpass -p|mysql .*-p|Bearer |AKIA' .claude/settings.local.json. Generic scanners missed many of these.
  • Confirm the ignore rule applies on each machine: git check-ignore -v .claude/settings.local.json.

What happened#

Security company Apiiro published research on November 5, 2026 showing that Claude Code's permission file is leaking credentials into public GitHub repositories. Apiiro's page was not readable by our tools, so the figures below come from The Hacker News and Security Online, which agree on the core numbers.

When you choose "Yes, and don't ask again" on a Bash prompt, Claude Code saves an allow rule in .claude/settings.local.json. If the approved command had a password or token on the command line, the secret can land in that file in plain text. This behavior was reported in August 2025 and that issue was closed as "not planned" by an inactivity bot in January 2026, with no maintainer reply in the thread.

Scanning between November 1 and 3, the researchers found 104,185 public copies of the file in 103,617 repositories. Of those, 1,122 copies, about 1.1%, held at least one secret, for 1,379 distinct secrets. They include 379 database passwords, 43 SSH logins for public servers and 23 AWS keys. Counting git history, the shared settings.json and saved agent chat logs, the total is 2,539 secrets across 1,994 repositories.

Who is affected#

You are affected only if a file like this reached a place others can read. The documentation says Claude Code adds **/.claude/settings.local.json to your global git excludes the first time it writes the file. That protects a normal setup on that machine. It does not help a file that was already tracked, one that was committed from a machine with different git configuration, a forced git add, or the 74 repositories whose forks carry the same secrets. It also does not cover the shared .claude/settings.json, which teams are told to commit and where 298 of 76,011 copies held secrets.

How the files got into git is disputed. Per Security Online, Claude Code lead Boris Cherny said on Hacker News on November 7 that the tool ignores the file when it creates it, so he believes exposed copies were created by hand and checked in. The researchers report that in 539 of 1,105 traced repositories, a commit crediting Claude as co-author changed the file. Both can be true, and neither changes what you should do if you find one.

Do you really need to act?#

Do a one-time search, and act only on what you find. This is not a remotely exploitable bug and no attacks using these secrets have been reported. Most users have nothing committed. The risk is concentrated in public repositories and in habits like typing PGPASSWORD=... or sshpass -p into an agent session. The researchers did not test whether the secrets still work, though Security Online reports that one notified organization confirmed its key was live. Every secret-bearing file was still on its default branch when scanned, and in half of those repositories it had been there at least 217 days.

No shipped fix is named in the reports we reviewed as of November 9. Cherny said the team is looking at prevention, including secret scanning. Do not rely on generic scanners in the meantime: Gitleaks flagged 564 of the 1,122 files, TruffleHog flagged 643, and neither flagged 215, mostly passwords typed inside commands.

What to do now#

  1. Search your organization: gh search code permissions --owner YOUR_ORG --filename settings.local.json, then again for settings.json.
  2. Rotate first. Removing a file from the tree leaves the secret in history and in forks.
  3. Run git rm --cached .claude/settings.local.json and add the path to the repository's .gitignore, so the protection does not depend on each developer's global git config.
  4. Delete literal secrets from allow rules in local copies. Pass credentials through variables such as $DATABASE_URL or a secrets manager.
  5. Prefer prefix rules such as Bash(npm run *). Decline "don't ask again" on any one-off command that contains a credential.
  6. Treat .claude/, .cursor/, .gemini/ and .specstory/ like .env files in review and scanner rules.

How to tell if you were hit#

Run git ls-files | grep -E '(^|/)\.claude/' and git log --all --oneline -- .claude/settings.local.json. Then read the file's permissions.allow entries, because pattern scanners miss passwords embedded in commands. If you find a secret in a public repository, assume it was harvested and review that credential's access logs for use you do not recognize.

Timeline#

  • — Issue #5544 reports credentials saved in plain text in settings.local.json.
  • — Issue closed as "not planned" by an inactivity bot.
  • — Apiiro scans public GitHub and notifies affected organizations on November 2 and 3.
  • — Apiiro publishes its research.
  • — Press coverage follows, and Boris Cherny responds on Hacker News.

Sources

Original sources first: vendor and project advisories, CVE and government records, the discoverers’ write-ups. Every claim above links to one of these. See how the Security Desk works.

Original and primary sources

  1. Anthropic — Claude Code settings documentation code.claude.com
  2. Anthropic — Claude Code permissions documentation code.claude.com
  3. anthropics/claude-code — Issue #5544: approved bash commands stored with plain text credentials github.com
  4. Security Online — Claude Code Leaking Secrets Across Nearly Two Thousand Public GitHub Repositories securityonline.info
  5. Runtime Wire — Apiiro finds secrets in 1,122 public Claude Code settings files runtimewire.com

Coverage and analysis

  1. The Hacker News — Claude Code's 'Don't Ask Again' File Exposes Passwords and Keys in 1,122 Public Copies on GitHub thehackernews.com