Claude Code Exposes Sensitive Information on GitHub Due to Settings Oversight
Claude Code is unintentionally leaking sensitive information on public GitHub instances due to a flaw in how its settings files are managed. This finding comes from AI security researchers at Apiiro, who discovered thousands of sensitive items, including database passwords, API tokens, and root logins, embedded within Claude Code settings files in GitHub repositories.
The leak originates from the way Claude Code handles user approval for automated shell commands. When users select the “Yes, and don’t ask again” option to approve a command, this choice is stored as part of a rule in the local “.claude/settings.local.json” file on the user’s computer. While the rule may be coded as a pattern, the command itself, often including sensitive information, is written directly to the settings file.
This situation does not pose a significant security risk if the settings file remains on the user’s local machine, assuming that machine is secure. Anthropic notes in its Claude Code documentation that this specific settings file is included in the developer’s global .gitignore list, which typically prevents it from being shared publicly.
However, the .gitignore setting is not enforced at the repository level, meaning the sensitive file can be accidentally uploaded if a repository is cloned to another machine or if a folder is later converted into a repository. Apiiro points out that in many instances, Claude Code will commit changes to the settings file without the user’s input.
Apiiro’s researchers identified over 100,000 instances where Claude Code’s local settings file was uploaded to public GitHub repositories. Among these, approximately 1,100 files from 63 different organizations contained sensitive information such as public API tokens, database passwords, or private keys. Even after these files are removed from a repository, the secrets can remain in forks of the original project if users are not careful.
Related link: apiiro.com
Source: Ars Technica AI