Problem Solutions
Claude Code’s “Don’t Ask Again” Saved Passwords and Keys Into Public GitHub Files
Security firm Apiiro published research on November 5, by Shmulik Cohen and Matan Giladi, titled “Coding Agents Are Leaking Your Secrets to GitHub”. Its finding is simple and alarming: when a Claude Code user approves a shell command with “Yes, and don't ask again”, the tool saves that command word for word — including any password or token typed into it — in a file inside the project folder. And that file has ended up in public GitHub repositories by the tens of thousands. Every figure in this article is Apiiro's, reported consistently across The Hacker News on November 6 and Cyber Security News on November 7. Apiiro sells application and agent security products, so its findings are vendor research, and the figures have not been independently replicated.
How the leak happens
By default, Claude Code asks before running most shell commands. If the user picks “Yes, and don't ask again”, it saves an allow rule in .claude/settings.local.json inside the project folder. The rule is the complete approved command, word for word — including any password or token typed into it — in plain text. Matching commands then run without asking in later sessions. Apiiro puts it bluntly: “This is Claude Code's own behavior, not the model's” — the researchers reproduced it with Anthropic's latest models, Opus 5.5 and Fable 5.1. Of 16 coding agents whose documentation the researchers compared, Claude Code is the only one confirmed to save the full approved command in a project file by default.
Why the file ends up on GitHub
The file is meant to stay on the developer's machine. Claude Code's settings documentation says the first time it writes the file in a git repository, it adds **/.claude/settings.local.json to the user's global git excludes, the core.excludesFile setting, typically in ~/.config/git/ignore. That protection does not travel with the project: Claude Code never adds the file to the project's own .gitignore, and the global exclude does nothing for a file already committed, a folder turned into a repository later, or a clone on another computer. In 539 of the 1,105 repositories Apiiro traced, a commit listing Claude as a co-author changed the file — Apiiro reads that as Claude often committing the file itself.
The numbers
Apiiro searched public GitHub code on default branches between November 1 and 3 and found 104,185 public copies of .claude/settings.local.json in 103,617 repositories. Of those, 1,122 — about 1.1% — hold at least one real secret, together holding 1,379 distinct secrets: 636 provider keys and 743 passwords or tokens for public hosts. The breakdown is concrete: 379 database passwords, more than a third of the secrets, each opening a database directly; 122 Supabase service-role keys; 103 Supabase account tokens; 43 SSH logins for public servers, some with root passwords; 42 tokens for GitHub, GitLab and npm; 23 AWS keys; and 6 private keys. Sixty-three organisations own files holding a real secret, mostly software companies of all sizes. The strongest cases Apiiro names are a database vendor's own admin-level cloud key, a production Azure Postgres password, a Square production token, and the owner password of a medical-records database. One notified company confirmed its exposed key had been live.
The exposure is not new. Every file with a secret was still on its repository's default branch as of the November 2 snapshot, and in half of those repositories it had been there for at least 217 days. Older versions of the file hold 734 more secrets across 509 repositories that are not present in any current copy, usually because the file was deleted. And 211 forks of 74 repositories carry the same secrets as the originals. Secrets also sit in 298 of 76,011 public copies of the shared .claude/settings.json file, which teams commit on purpose, mostly inside allow rules. Including older versions, the shared settings file and saved agent chat logs and transcripts, the total is 2,539 distinct secrets across 1,994 repositories.
Scanners miss one in five
Of the 1,122 files with a real secret, gitleaks flagged 564 and TruffleHog flagged 643 — and 215, or 19.2%, were flagged by neither. The misses are mostly passwords typed inside commands, such as after PGPASSWORD=, sshpass -p or mysql -p, which lack recognisable key formats. There is an uncomfortable echo here: in September 2025 the Shai-Hulud npm worm ran TruffleHog over victims' files — the same scanner that flags 643 of these 1,122. A clean scan result is not proof that a repository is clean.
What counts as a real secret
A value counted as a secret when it matched a known key format, or when a password or token sat beside the address of a public server, and an AI reviewer also had to agree. Apiiro did not test any credential and contacted no host, so “real secret” means a value matching its rules and review, not proof that every key still works — the only confirmation of a live key is the single company above. The counts are a floor for public GitHub, not a measure of valid credentials, and private repositories and developers' machines are out of scope.
Reported since August 2025, no reply from Anthropic
Users reported this behaviour on Claude Code's GitHub tracker as early as August 2025. The earliest cited report, filed August 11, 2025, said approved commands with API keys and tokens were being stored word for word in settings.local.json; an automated bot closed it as “not planned” on January 3 after 60 days without activity. Apiiro cites four related reports. All four have been closed by the same bot, the most recent on November 4 — the day before the research was published — and none received a reply from Anthropic. As of November 8 there is no public reply from Anthropic and no change to the documentation on this point, and no vendor patch is cited in the reports. The fix, for now, is the user's.
What to do
First, search your GitHub organisation for .claude/settings.local.json and .claude/settings.json, and check each repository's git history for them, even where the files are gone — deleting the file does not undo the leak, because older versions stay in git history and in forks. Second, rotate first, then clean up: change every password, token and key the files have ever held before removing files or rewriting history. Third, stop tracking the local file with git rm --cached .claude/settings.local.json and add it to the repository's own .gitignore. Fourth, open the file on your own computer — even if it was never committed — and delete every rule that contains a secret. Fifth, keep secrets out of commands: refer to them as variables from a secrets manager, such as $DB_URL, so the saved rule holds the variable name, not the secret, and approve patterns such as Bash(npm run:*) instead of single commands. Sixth, for security teams: treat agent folders like .claude/, .cursor/, .gemini/ and .specstory/, and agent memory files, as holding secrets, like .env files, on laptops as well as in repositories — add them to pre-commit and CI secret scanning including git history, with checks for passwords inside commands, not only known key formats, add .claude/settings.local.json to the organisation's .gitignore templates, and check credentials paired with a public server first. Seventh, remember the local risk: the file is plain JSON in the project folder and can also end up inside an npm package, a Docker image, a zip archive or a synced folder, and malware can read plaintext settings on a compromised laptop.
A different leak from the one reported on November 6
Do not confuse this with the DigestX article published on November 6, which is about Claude Code leaking the user's email address in the User-Agent header of web requests, from GitHub issue 107757. That is a different mechanism with a different fix: an email address in a request header, not credentials saved into a settings file and committed to GitHub. The email-leak article is linked below as a related story, not a duplicate.