Skip links

Claude Code Unintentionally Reveals Sensitive Information Across GitHub

Claude Code has been found to unwittingly expose sensitive information on public instances of GitHub, according to a recent analysis by security researchers at Apiiro. This breach has led to the discovery of thousands of confidential credentials, such as database passwords and API tokens, embedded within the settings files of Claude Code that were uploaded to public repositories.

The root of this problem lies in how Claude Code manages user approvals for automated shell commands. When users opt for the “Yes, and don’t ask again” feature, that decision is recorded in the local .claude/settings.local.json file on their computers. While rules might be set up as patterns, the actual commands, which potentially contain sensitive information, are stored verbatim.

This situation is not overly concerning as long as the settings file remains on the user’s local machine, provided that machine is secure. Notably, Anthropic, the creator of Claude Code, indicates in its documentation that this settings file is typically included in the developer’s global .gitignore list, which is designed to prevent unintended public sharing.

However, the .gitignore directive does not apply at the repository level. This raises the risk that users could accidentally upload sensitive settings if a repository is cloned to a different machine or if a folder is initialized as a repository in the future. Moreover, in many instances, Claude Code commits alterations to the settings file without user intervention, exacerbating the potential for leaks, as detailed by Apiiro.


Secrets found in Claude Code settings

A summary of the types of sensitive data exposed due to mishandled Claude Code settings files.

A summary of the types of sensitive data exposed due to mishandled Claude Code settings files.

Credit: Apiiro

Apiiro’s research revealed over 100,000 instances where the Claude Code local settings file had been pushed to public GitHub repositories. Out of these instances, approximately 1,100 files originating from 63 different organizations contained secrets, such as API tokens and private keys. Moreover, even after such files are discarded from a repository, the sensitive information could still exist in forks if users are not diligent.

Editor’s Take

This development highlights significant vulnerabilities in the management of sensitive information by AI tools like Claude Code. For users and developers, this serves as a stark reminder to remain vigilant with configuration files that may unintentionally reveal critical credentials. Businesses should reevaluate their security protocols to protect against such unintentional data leaks, especially in collaborative environments where code is often shared publicly.

Source: arstechnica.com