← 返回 🛠️ 科技 & 互联网

Claude Code Has Been Leaking Secrets through its "Don't Ask Again" Feature

InfoQ — News Sergio De Simone 1 天前 www.infoq.com

InfoQ Homepage News Claude Code Has Been Leaking Secrets through its "Don't Ask Again" Feature

DevOps QCon AI New York (Dec 15–16): Production AI lessons from senior engineers.

Claude Code Has Been Leaking Secrets through its "Don't Ask Again" Feature

Nov 22, 2026 2 min read

by

Follow us on

Youtube232K Followers Linkedin26K Followers InstagramNew RSS19K Readers X57.1k Followers Facebook21K Likes BlueskyNew Listen to this article - 0:00 Audio ready to play Your browser does not support the audio element. 0:00 0:00

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 company 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.

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.

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.

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:

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 issues.

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.

About the Author

Sergio De Simone

Show moreShow less

This content is in the DevOps topic

Related Topics:

The InfoQ Newsletter

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

We protect your privacy.

在原文站打开 ↗

Cloudflare Workers 每 3 分钟抓一批,9 批轮完最快约 27 分钟 · 点右上 ↻ 立刻全量抓一次