Credential Rotation Required

Claude Code Exposed Secrets in Public GitHub Repositories

Claude Code, Claude Code secrets, GitHub security, Claude Code secrets exposed on GitHub, Passwords exposed in public GitHub repositories
Facebook
X
LinkedIn
Reddit
WhatsApp
Source: Casimiro PT/Shutterstock.com

A convenience feature in Anthropic’s AI coding tool Claude Code stored approved commands along with passwords in plaintext. Apiiro found genuine credentials in 1,122 public files.

A convenience feature in Anthropic’s AI coding tool Claude Code has caused passwords, API keys and SSH credentials to end up in public GitHub repositories. Security firm Apiiro reported the findings in an investigation published on November 5. Claude Code asks users for permission before executing most shell commands. If users select the “Yes, and don’t ask again” option, the tool saves the corresponding approval rule in the .claude/settings.local.json file in the project directory. If the approved command contains a password or token, the credential is stored in plaintext in that file.

Ad

1,379 Secrets Found in Current Files

Apiiro scanned GitHub and identified 104,185 public copies of the file across 103,617 repositories. Of these, 1,122 contained at least one genuine secret, amounting to 1,379 unique credentials. Of those, 636 were keys matching known provider formats, while 743 were passwords or tokens associated with publicly accessible hosts. More than a third provided direct access to databases. These included 379 database passwords and 122 service role keys for the database platform Supabase.

By also examining Git history, shared configuration files and stored agent logs, Apiiro identified a total of 2,539 unique secrets across 1,994 repositories. Forks further spread the exposed credentials: secrets from 74 repositories appeared in another 211 copies. According to Apiiro, the company notified 63 affected organizations.

Secret Scanners Miss One in Five Exposures

Common secret detection tools only catch some of these exposures. Gitleaks flagged 564 of the 1,122 files, while TruffleHog detected 643. Neither tool identified 215 files, or roughly one in five. The reason is that scanners typically look for known key formats. A password passed directly in a command-line argument, for example using sshpass -p or mysql -p, looks like an ordinary word and can therefore escape detection.

Ad

Claude Code does add the file to Git’s global ignore list when it is created in a repository. However, Apiiro reports that this protection does not work in every case. In 539 of the 1,105 repositories examined, Claude Code had committed the file itself. The reports did not include a statement from Anthropic.

Rotate Credentials First

Developers who have used the option should check their .claude/settings.local.json files. Any credentials found there should be rotated first. Simply deleting the file does not remove it from Git history or clean up existing forks and clones. After rotating the credentials, developers should remove the file from version control using git rm --cached and add it to the respective repository’s .gitignore file. As a general rule, secrets should never be included directly in commands. Instead, they should be supplied through environment variables sourced from a secrets manager.

(Editorial Team)

Ad

Artikel zu diesem Thema

Weitere Artikel