🌏 中文版
What Happened
Application security firm Apiiro published research on November 5 showing that when a user picks "Yes, and don't ask again" on a shell command in Anthropic's Claude Code, the tool can save that exact command into the project's .claude/settings.local.json, to be auto-approved on future runs. The problem: if the command the user typed or approved already contained a password, API key, or token — something like mysql -pYourPassword — that secret gets written into the file verbatim along with the rest of the command. And that file is often committed to public GitHub repos, sometimes by Claude Code itself. Apiiro scanned 104,185 public copies of the file on GitHub and found 1,122 containing at least one secret, 1,379 secrets in total. Add older versions still sitting in git history, .claude/settings.json files teams share on purpose, and saved agent transcripts, and the total climbs to 2,539 secrets across 1,994 repositories and 63 organizations. Apiiro notified one of the affected companies, which confirmed its leaked key was still live.
Basics
| Field | Value |
|---|---|
| Incident type | Secret exposure (design flaw in a coding agent's permission cache) |
| Scope | Public GitHub repos where Claude Code was used with "don't ask again"; 63 organizations affected |
| Severity | High |
| CVE | None (research disclosure, no CVE assigned) |
| Sources | Apiiro research, The Hacker News |
Attack Surface Analysis
The root cause is that Claude Code's permission cache only remembers what got approved, not why. The first time a user runs a command that touches sensitive data — connecting to a database, logging into a server with sshpass, calling a cloud API — Claude Code asks for approval. If the user picks "don't ask again," the rule it saves is sometimes a pattern like npm test *. But if what got approved was one specific, complete command rather than a pattern, Claude Code writes that entire command string — hardcoded password or token included — character for character into .claude/settings.local.json. Apiiro reproduced the same behavior with the current Opus 5.5 and Fable 5.1 models, confirming this isn't limited to older versions.
What turns this into a bigger problem is that the git-level protection is only half-built: the first time Claude Code writes this file inside a git repo, it adds the file to that one computer's global git exclude list — but it never writes an entry into the project's own .gitignore. That means the protection travels with "this computer, this user," not with the project. The moment the file exists on a different machine, or was already committed before the global exclude took effect, the protection does nothing — and Apiiro found that in 539 of the 1,105 repos it traced, the commit that touched this file listed Claude as a co-author, suggesting Claude Code often commits the file itself. Worse, deleting the file doesn't undo the leak: old versions persist in git history and in forks. Apiiro separately found 734 secrets across 509 repos' historical versions that no longer appear in the current copy, and 211 forks that carried the same leaked secrets forward from their originals.
- User approves a command containing a password, picking "don't ask again"
- Decide whether what got approved was a pattern or a full command
- A pattern gets saved as just the pattern, no password included
- A full command gets saved verbatim, password and all, into the settings file
- Decide whether the global exclude rule is active on this copy of the file
- Active means temporary safety on this machine; inactive or already committed means it leaks straight to a public repo
- Temporary safety doesn't last — a different machine or a fork leaks it just the same
- Once leaked, history and forks keep the secret alive even after the current file is deleted
Simplified; based on Apiiro's Nov 5, 2026 research.
Mapped onto the OWASP LLM Top 10, this incident hits both LLM02 Sensitive Information Disclosure (secrets improperly retained and exposed) and LLM06 Excessive Agency (when an agent is granted the ability to auto-rerun a command, failing to separate "the command's operating pattern" from "the sensitive parameters embedded in it" hands too much autonomy to a caching mechanism that just copies whatever the user typed). Notably, Apiiro compared the documentation of 16 coding agents and found Claude Code is the only one confirmed to save the full approved command into a project file by default.
Defenses
Immediate actions
- Search your GitHub organization for
.claude/settings.local.jsonand.claude/settings.json, including each repo's git history, even where the file has since been deleted - For any file containing a secret, rotate first, clean up second: assume every password, token, and key it ever held has leaked, and revoke and reissue each one
- Run
git rm --cached .claude/settings.local.jsonto untrack the file, and add a repo-level.gitignorerule — don't rely solely on the global exclude list Claude Code writes
Long-term architecture
- Approve patterns rather than exact commands wherever possible (e.g.
Bash(npm run:*)); reference passwords as environment variables (like$DB_PASSWORD) in commands so the cached rule only ever stores the variable name - Treat agent config folders like
.claude/,.cursor/,.gemini/, and saved agent transcripts as secret-bearing, the same as.envfiles, and add them to pre-commit and CI secret scanning, including git history - Standard secret scanners often miss this pattern: Apiiro found gitleaks and TruffleHog caught only 564 and 643 of the 1,122 problem files respectively, with 215 missed by both, because passwords following
PGPASSWORD=,sshpass -p, ormysql -pdon't match typical key-format rules. To close that gap, a runtime governance platform from watchlist B7 like WitnessAI — built to continuously capture and audit what agents actually do, including shell commands and tool calls — can intercept a command before it's approved and cached, rather than relying on scanning after the commit already happened
Impact
At the time Apiiro checked, every file containing a secret was still sitting on its repo's default branch, and half had been there for at least 217 days untouched. Most of the 63 affected organizations are software companies; researchers specifically called out two of the more severe cases: a database vendor's own admin-level cloud key, and the owner password for a medical-records database. Researchers didn't test whether the secrets still worked and didn't contact any server to verify, so the one confirmed-live key came only from a single notified company — meaning the real scale of exploitable exposure is likely harder to pin down than the "2,539" headline number suggests. Worth noting: GitHub issues reporting this same behavior date back to at least August 2025, but every related report was closed by an automated bot without any reply from Anthropic.
If you or your team use Claude Code — or any coding agent that caches and reruns approved commands — this incident means "don't ask again" itself is an attack surface worth re-evaluating. It was built to cut down on approval friction, but it can just as easily turn the secrets you habitually paste into a terminal into a leak that sits quietly in a public repo for months.
Today's Takeaway
What makes this incident interesting is that it didn't need an attacker at all: no malware, no prompt injection, no supply-chain poisoning. A design decision made purely for convenience — caching whatever the user typed — stacked on top of a protection boundary drawn in the wrong place — tied to one user's local machine instead of the project — was enough on its own to leak secrets at scale. Compared to the deliberate attack chains covered here before, this is a reminder to ask, of any agent feature that "remembers what you approved last time": is it remembering how you did something, or is it also remembering exactly what you typed while doing it?
References
- Apiiro — Coding Agents Are Leaking Secrets to GitHub via "Don't Ask Again"
- The Hacker News — Claude Code's "Don't Ask Again" File Exposes Passwords and Keys in 1,122 Public Copies on GitHub
- GBHackers — Claude Code's "Don't Ask Again" Feature Exposes 2,539 Secrets Across 1,994 GitHub Repositories
- Claude Code docs — Permissions
- Claude Code docs — Settings
- GitHub Issue #5544 (filed 2025-08-11, auto-closed)
- OWASP Top 10 for LLM Applications