InfoQ Homepage News Claude Code Has Been Leaking Secrets through its "Don't Ask Again" Feature.
Nov 22, 2026 2 min read.
Recent findings suggest that agentic security firm Apiiro found that Claude Code has been exposing secrets in public repositories due to how it stores them in local file on developers' machines to implement the "Don't Ask Again" feature. The organization identified 1,122 secrets in claude/settings.local.json files and another 1,160 in git history, in the shared settings.json intentionally committed, and in agent chat transcripts stored in repos.
Industry observers note that the problem lies in how Claude Code handles command approval. When developers reply "Yes, and donโt ask again" to approve a shell command, Claude Code saves it as a permanent permission rule in the local configuration file .claude/settings.local.json, which may end up inadvertently containing embedded credentials, passwords and API tokens.
When [Claude Code] creates the file inside a git repo, it adds it to the developer's global git ignore list. That covers the common case. It doesnโt cover a folder that becomes a repo later, a clone on another machine, or a file someone already committed. The rule never goes into the repo's own .gitignore, so nothing travels with the project to protect it.
In a recent development, on some occasions, the researchers found, Claude Code itself committed the file. Overall 63 organizations were affected, with exposed secrets including cloud API keys, production passwords and access tokens, and npm tokens. Generic secret scanners such as gitleaks and TruffleHog failed to flag all exposed secrets, mostly because they were embedded inside shell commands.
The same password-in-a-command pattern appears wherever an agent records what it ran: transcripts, memory files, handoff notes, and a scanner tuned to key formats misses it in all of them.
The researches also note that the way Claude Code manages secrets is a security gap in itself, as to any malware "itโs a list of the systems the developer can reach and the passwords that open them, one file search away", available at the same path in every project.
Recent findings suggest that apiiro's findings were later reinforced by GitGuardian, which found 31,088 secrets in Claude Codeโs .claude/settings.local.json on public GitHub, 5,343 of which were still valid at the time of detection, as well as another 613 in Docker Hub images. GitGuardian had previously warned that "Cursor, Claude Code, and GitHub Copilot leave credentials scattered across config files, logs, and shell history".
Commenting on the findings, Reddit user T_Thriller_T observed that "Somewhere, someone said AI companies are ignoring basic cyber security principles".
User MattV0 suggested an interesting approach to the whole matter of how to deal with AI files:.
Recent findings suggest that while this is about secrets, I totally stopped adding AI files into my projects. Means no settings, CLAUDE.md, AGENTS.md or anything else. I even turned off Claude's memory. [...] Nowadays I use a memory/task/docs server through mcp and it really improved such documentation problems.
In a recent development, at very very least, Apiiro recommends untracking the json file using git rm --cached .claude/settings.local.json and adding it to the repo's .gitignore, as well as rotating every credentials the file has ever contained. For a sounder approach, the researchers also recommend inspecting the file and deleting any rule that contains a secret, and avoid typing secrets directly into commands, referencing them instead through environment variables.
Microsoft Ignite 2026; Explore What's Next in AI and Software Engineering - Learn how to architect agentic systems, modernize cloud infrastructure, and tackle emerging engineering challenges. Get practical insights from Microsoft experts and industry leaders. Microsoft Ignite is less than two weeks away! Register now to join us in person or attend online for free, November 17โ20.
A round-up of last weekโs content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example.
