Urgent.News

What's breaking now, across hundreds of outlets.

AI

Claude Code Has Been Leaking Secrets Through Its "Don't Ask Again" Feature

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 "Don't Ask Again". The company identified 1,122 secrets in claude/settings.local.json files and another 1,160 in git history, in the shared settings.json, and in agent chat transcripts stored in repos. By Sergio De Simone

Claude Code, an agentic tool developed by Apiiro, has been exposed for leaking sensitive information in public repositories. The issue arises from the way Claude Code stores secrets locally to enable the "Don't Ask Again" feature. When developers approve a shell command by agreeing "Yes, and don’t ask again," the command is saved permanently in a configuration file (.claude/settings.local.json), potentially exposing credentials, passwords, and API tokens.

The problem is compounded by the fact that the rule is not included in the repository's .gitignore, meaning it is not excluded from the project when cloned or committed. This oversight leaves the secrets vulnerable, as the file may be transferred to other machines or become part of a new repository.

Apiiro discovered 2,282 secrets in total, including cloud API keys, production passwords, access tokens, and npm tokens, affecting 63 organizations. Unfortunately, generic secret scanners like gitleaks and TruffleHog were unable to detect all the exposed secrets, as they were embedded within shell commands.

The security gap extends beyond the configuration file, as Claude Code stores transcripts, memory files, handoff notes, and agent chat transcripts, which could potentially contain the same sensitive information. Apiiro also warns that this vulnerability could provide malware with a list of systems the developer can reach and access, making it a significant security concern.

GitGuardian corroborated Apiiro's findings, identifying 31,088 secrets in Claude Code’s .claude/settings.local.json on public GitHub, with 5,343 still valid at the time of detection. Additionally, the security firm found 613 secrets in Docker Hub images.

The issue has sparked discussions within the developer community, with some users opting to exclude AI-related files from their projects and turn off AI memory features. Apiiro recommends removing the file from version control using git rm --cached .claude/settings.local.json, adding it to the repo's .gitignore, rotating credentials, and inspecting the file to delete any rules containing secrets. Instead of directly typing secrets, the researchers advise using environment variables.

Rewritten by urgent.news; may contain errors — check the original.

Source: infoq.com

Read the original at infoq.com →

Report a problem with this story

More in AI

More from Sunday 22 November →