When a developer picks “Yes, and don’t ask again” in Claude Code, the assistant can save the exact command as a permission rule in .claude/settings.local.json. If that command had a password or API key in it, the secret is now in a plain JSON file in the project.
Get the CyberExperts Daily Brief: the day's top security news in 5 minutes. Free.
Apiiro searched public GitHub and found 1,122 copies of that file holding at least one secret, 1,379 distinct secrets in all. More than a third open a database directly.
Claude Code’s settings.local.json can hold the exact command you approved, password and all. Rotate what it held before you delete it.
The 5-Minute Cyber BriefDon’t Miss the Policy Changes That Affect Security Decisions
Get the key CISA actions, new regulations, guidance, and risk shifts in a quick daily brief.
By subscribing you agree to our Privacy Policy.
Free. Weekday mornings. 5 minutes or less.
Claude Code saved approved commands, passwords included
Apiiro’s November 5 research found 104,185 copies of .claude/settings.local.json in 103,617 public repositories. About 1.1% held a secret. The haul includes 379 database passwords, 43 SSH logins for public servers, 42 GitHub, GitLab and npm tokens, and 23 AWS keys, across 63 organizations.
Claude Code adds the file to a user’s global git excludes the first time it writes it, according to its settings documentation. That protection lives on one machine. It does nothing for a file already committed, and Claude Code never adds the file to the project’s own .gitignore. In 539 of 1,105 repositories traced, a commit co-authored by Claude changed the file.
- Older versions in git history hold 734 more secrets across 509 repositories, and 211 forks carry copies of the same secrets.
- Counting the shared
.claude/settings.json, history and saved agent chat logs, Apiiro counted 2,539 secrets in 1,994 repositories. - gitleaks flagged 564 of the 1,122 files and TruffleHog 643; neither caught 215, mostly passwords typed inside commands.
Teams whose repos carry .claude folders
This sits in repositories, but also in npm packages, Docker images, zip archives and synced folders, because the file is plain JSON in the project folder. Apiiro did not test whether the secrets still work. One company it notified confirmed its key had been live.
Common scanners look for known key formats. A password after PGPASSWORD=, sshpass -p or mysql -p looks like an ordinary word, so a clean scan does not clear these files.
Rotate first, then untrack the file
- Search your GitHub or GitLab organization for
.claude/settings.local.jsonand.claude/settings.json, including git history where the file was deleted. - Rotate every password, token and key those files have ever held before you clean up. Start with credentials paired with a public server address.
- Untrack the local file with
git rm --cached .claude/settings.local.jsonand add it to each repository’s.gitignoreand your org templates. - Open the file on developer laptops, even where it was never committed, and delete rules that contain secrets.
- Have developers reference secrets as variables (for example
$DB_URL) and approve patterns such asBash(npm run:*)instead of single commands.
Forward this
For whoever owns our source code and developer tooling: Claude Code can save approved commands, passwords included, into .claude/settings.local.json, and Apiiro found more than a thousand public copies holding live-looking secrets. Can we search our repos and their history for that file, rotate anything it held, and add it to .gitignore?
Details
- File:
.claude/settings.local.json(per-project allow rules from “Yes, and don’t ask again”); also.claude/settings.json. - Apiiro (November 5, 2026): 1,122 public copies with at least one secret; 1,379 distinct secrets; 734 more in history; 63 organizations. No CVE has been assigned.
- Vendor response: Apiiro says four related GitHub issues were closed by an automated bot without a reply from Anthropic.
Hunt / verify
- Add
.claude/,.cursor/,.gemini/and similar agent folders to pre-commit and CI secret scanning, including history. - Grep agent folders for
PGPASSWORD=,sshpass -p,mysql -pand connection strings with inline credentials. - Check package and image build contexts for
.claude/folders that ship with releases.
Source: Apiiro research; The Hacker News write-up
Sources
- Apiiro: coding agents leaking secrets via “don’t ask again” (November 5, 2026)
- The Hacker News: Claude Code’s “Don’t Ask Again” File Exposes Passwords and Keys in 1,122 Public Copies on GitHub
- Claude Code docs: Settings
- iTWire: Claude Code approval files found exposing company secrets on GitHub
Start your morning with the signal that matters.
Get the biggest cybersecurity developments, why they matter, and where to go deeper on CyberExperts.
By subscribing you agree to our Privacy Policy.
Free. Weekdays. Built for operators.