In a recent disclosure, sensitive data including passwords and API keys have been found in public GitHub repositories due to a vulnerability in Claude Code, an AI coding assistant by Anthropic. These secrets were unintentionally saved in project files, posing a significant security risk.
Vulnerability Details
When developers used the ‘Yes, and don’t ask again’ option in Claude Code, commands containing sensitive data were stored in the .claude/settings.local.json file. Apiiro, a software security firm, revealed that 1,122 public copies of this file contain at least one secret. Though it’s unclear if these credentials are still active, one company confirmed a live key was exposed.
The file persists in the project’s git history and forks, even if removed from the main directory. To mitigate risk, it is crucial to rotate all affected passwords and keys, then thoroughly clean the repository history.
How Secrets Get Exposed
Claude Code prompts for approval before executing shell commands. If a user opts not to be asked again, the exact command, including any secrets, is saved. This behavior was confirmed with the latest models, Opus 5.5 and Fable 5.1. Despite attempts to exclude the file from git, its presence in committed repositories remains a critical issue.
Apiiro’s investigation found over 100,000 copies of the settings file, with a fraction containing secrets such as database credentials, SSH logins, and API tokens. These files remained on GitHub for extended periods, highlighting the need for improved security measures.
Recommendations for Developers and Security Teams
Developers are urged to search for these files across their GitHub repositories and rotate any exposed credentials. They should also stop tracking these files in git and use variables from a secrets manager to avoid saving secrets in commands.
Security teams should treat directories like .claude/ as containing secrets and integrate them into pre-commit and CI secret scanning processes. Special attention should be given to credentials linked to public servers due to their heightened risk.
Previous Concerns and Future Implications
Concerns over this issue are not new, as similar reports have been filed previously, but were closed without resolution. The ongoing exposure of sensitive data underscores the need for proactive security practices in software development.
Moving forward, developers and organizations must remain vigilant, employing robust security protocols to safeguard sensitive information and prevent unauthorized access.
