AI Security
Claude Code's Auto-Save Feature Leaks Thousands of Credentials on GitHub
Researchers uncovered over 100,000 instances where Claude Code's settings files containing API tokens and passwords were uploaded to public repositories.
1/2
Ars Technica
Claude Code, Anthropic's AI-powered development tool, is inadvertently exposing sensitive credentials online through a configuration oversight. Security researchers at Apiiro identified thousands of database passwords, API tokens, and private keys scattered across public GitHub repositories, embedded within Claude Code's settings files.
How the Exposure Occurs#
The vulnerability emerges from how Claude Code manages user permissions. When developers approve shell command execution using the "Yes, and don't ask again" option, the tool stores that decision in a local .claude/settings.local.json file. The problem: commands containing sensitive data—such as credentials or secrets—get written directly into this file instead of being abstracted as patterns.
Typically, this would remain harmless if the file stayed confined to a developer's machine. Anthropic's documentation indicates that the settings file should be automatically ignored by Git through the developer's global .gitignore configuration. However, that protection doesn't extend to individual repositories.
Why Secrets End Up Public#
The real-world exposure stems from several common scenarios:
- Cloning a repository to a new machine can trigger Claude Code to commit the settings file
- Converting an ordinary folder into a Git repository after Claude Code has already stored settings
- Claude Code itself automatically staging and committing changes to the file without explicit user approval
- Secrets persisting in repository forks if users don't manually purge them
The Scale of the Problem#
Apiiro's scan uncovered more than 100,000 instances of Claude Code's settings files on public GitHub repositories. Roughly 1,100 of these—spread across 63 organizations—actually contained exposed credentials like API tokens, database access details, or cryptographic keys.
Lingering Risks#
Even after developers discover and remove these files from their main repository, the secrets can remain accessible through GitHub forks. Users must actively clean up forked copies to fully eliminate the exposure risk.
For more details on the discovery, see Apiiro's full security report.
