Claude Code’s “Don’t Ask Again” option is designed to reduce repeated prompts. After a developer approves a shell command, the tool can save a persistent permission rule so it does not ask again for similar actions. Security firm Apiiro says that this mechanism can preserve command text containing credentials in local configuration. If that file is committed to a repository, the credentials may become public along with the project.
What researchers reported
Apiiro found 1,122 secrets in claude/settings.local.json. It reported another 1,160 in Git history, shared settings.json files that had been committed, and agent chat records stored in repositories. Researchers also said they found cases in which Claude Code itself committed the file. The exposed material included cloud API keys, production passwords, access tokens, and npm tokens, with 63 organizations affected.
GitGuardian later published a separate set of findings: 31,088 secrets in .claude/settings.local.json files across public Claude Code GitHub repositories, of which 5,343 were still active at the time of detection. It also found another 613 in Docker Hub images. These figures come from different scans and scopes, so they should not be added together as a single total.
The issue is not simply that a configuration file might lack an ignore rule. When a developer chooses “Yes, and don’t ask again,” Claude Code saves a lasting command-approval rule. If the approved command contains a password or token directly, that text may be copied into the local settings file. It may also remain in chat logs, memory files, handoff notes, or other agent-generated records. Claude Code adds the local file to the developer machine’s global Git ignore list, but that protection has limits: the file may be added to a repository later, a clone on another machine may not share the same global setting, or the file may already have been committed. A global ignore rule also does not travel with the project in its .gitignore file.
Why the findings matter
Conventional secret scanners often look for patterns associated with known credential formats. Apiiro said tools such as Gitleaks and TruffleHog did not flag every exposed secret because some credentials were embedded in shell command text. That makes the search problem broader than source code and configuration: teams may need to review agent transcripts, command records, and other generated files too. Researchers also warned that permission rules can become high-value targets, potentially revealing both credentials and the systems a developer can access.
For remediation, Apiiro recommends untracking the file with git rm --cached .claude/settings.local.json, adding it to the repository’s .gitignore, inspecting its contents, and rotating every credential that appeared there. Developers should avoid placing secrets directly in commands and use references such as environment variables instead. They should also check chat histories and related agent files for copies of the same credentials. Deleting a file does not invalidate a leaked token; rotation is an essential part of remediation.
The incident is a reminder that convenience features create new places where sensitive data can persist. Permission records, conversations, and agent memory should be included in repository governance and credential-handling practices—not left to default ignore settings or generic scanners alone.
Source: InfoQ 中文
Comments
Checking sign-in status...
Loading comments...