Claude Code Exposes Secrets on GitHub Due to Configuration Oversight
Apiiro researchers found thousands of sensitive details, including database passwords and API tokens, in Claude Code settings files accidentally uploaded to public GitHub repositories.
Overview of the Security Leak
Claude Code is accidentally exposing secrets all over GitHub due to a partial oversight in how its settings files are handled. AI security researchers at Apiiro discovered thousands of sensitive details, including database passwords, API tokens, and root logins, within Claude Code settings files embedded in public GitHub repositories. The leak originates from the way Claude Code manages user approval for automated shell commands. These findings highlight a critical vulnerability in the system's handling of configuration files, which could allow unauthorized access to sensitive data. Apiiro's research underscores the importance of rigorous security checks in AI tools that interact with code repositories. The issue has not been quantified with specific numbers, and the full scope of the exposure remains under investigation.
Mechanism Behind the Leak
The mechanism behind the leak involves how Claude Code stores user preferences locally. When a user selects the “Yes, and don’t ask again” option to approve a command, this choice is saved in the local “.claude/settings.local.json” file on the user’s computer, as noted in the documentation. According to Anthropic, this file should be excluded from public sharing by being added to the global .gitignore list. However, this exclusion is not applied at the repository level, which means the file can be accidentally committed and uploaded to GitHub if a repository is cloned to another machine or if a folder later becomes a repository. This oversight creates a risk of exposing sensitive information, such as user preferences and potentially other local settings, to public view.
Extent of the Leak and Its Impact
Apiiro’s researchers found over 100,000 cases where Claude Code’s local settings file had been uploaded to a public GitHub repository. Of these, only about 1,100 from 63 different organizations contained secrets such as public API tokens, database passwords, or private keys. In many cases, Claude Code itself will commit changes to the settings file without the user’s input, Apiiro writes. This accidental exposure highlights a significant risk for developers who rely on AI-assisted coding tools, as sensitive information can be inadvertently shared publicly. The findings underscore the need for greater awareness and more robust safeguards to prevent unintended data leaks.
Persistence of Secrets and Previous Reports
Persistence of secrets in GitHub repositories remains a critical concern, even after initial discovery and removal. As noted in a Claude Code bug report from August 2025, sensitive information can linger in forks of the original project if users do not take proper precautions. This issue has been previously flagged, highlighting a recurring challenge in managing secret exposure. Additionally, other reports have indicated that sensitive settings files are sometimes omitted from the .gitignore list, or that Claude Code may inadvertently add sensitive commands to unprotected files. These findings underscore the need for heightened awareness and more robust safeguards to prevent unintended sharing of confidential data. The persistence of such vulnerabilities over time suggests that while attention is growing, systemic solutions remain elusive.
Limitations of Secret Scanners and Broader Context
Limitations of Secret Scanners and Broader Context
The Apiiro researchers found that 215 of the roughly 1,100 public secrets it found in Claude Code settings files were not flagged by two popular secret scanners, gitleaks and TruffleHog Ars Technica AI. This highlights a critical gap in current secret scanning tools, which may fail to detect certain types of sensitive information, leaving systems vulnerable to exposure. This is far from the only case of an AI agent unintentionally leaking sensitive information Ars Technica AI. As AI models become more integrated into development workflows, the risk of accidental data exposure increases, underscoring the need for more robust security measures and improved scanning technologies.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.