Zero Day Room
Live
Incidents

Claude Code settings.local.json exposes secrets in public repositories

A security flaw in Claude Code's default configuration has exposed over 1,300 unique passwords and API keys across more than a thousand public GitHub repositories, with secrets persisting in git history and forks.

A security flaw in Claude Code's default configuration has exposed over 1,300 unique passwords and API keys across more...

Claude Code's default behavior has exposed thousands of credentials in public GitHub repositories. The coding assistant saves passwords and API keys in plain text within a project configuration file that is not automatically protected from public exposure.

When a user approves a command containing a secret and selects 'Yes, and don't ask again', Claude Code saves the entire approved command verbatim in a file named .claude/settings.local.json. This file is intended for personal use on a developer's local machine. However, because it is not added to the project's .gitignore file by default, it can be inadvertently committed and pushed to a public repository. One affected company confirmed that its exposed key had been live.

Widespread exposure in public repositories

Researchers examined 104,185 public copies of the .claude/settings.local.json file across 103,617 repositories. Of these, 1,122 files were found to contain at least one exposed secret. This represents 1.1% of all public copies of the file. Across those 1,122 files, a total of 1,379 distinct credential values were identified.

MetricFigure
Public copies of settings.local.json examined104,185
Files containing at least one secret1,122
Percentage of files with secrets1.1%
Unique secrets identified1,379

Secrets include critical credentials across organizations

The exposed credentials span a wide range of sensitive access keys. The breakdown includes database passwords, SSH logins, and cloud service API keys. A broader investigation that included Git history and agent transcripts identified 2,539 distinct secrets across 1,994 repositories.

Secret TypeCount Found
Database Passwords379
SSH Logins43
GitHub/GitLab/npm Tokens42
AWS Keys23

Files containing secrets were linked to 63 different organizations. Impacted entities included a database vendor with an exposed cloud key and a medical-records database with a leaked password. Secrets have been present in half of the affected repositories for at least 217 days. Research published on 5 November by Apiiro researchers Shmulik Cohen and Matan Giladi collected this data between 1 and 3 November, with notifications sent to affected organizations on 2 and 3 November. The researchers did not test whether the exposed credentials were valid or actively used.

Remediation challenges persist due to git history

Simply deleting the exposed settings file from a repository is an ineffective remediation. Because the file is often already tracked in version control, older versions remain accessible in the repository's git history, in any forks of the project, and in existing clones. Git's ignore rules do not apply to files already committed, and a global Git exclude only applies locally on a developer's machine. This makes complete removal from the public sphere nearly impossible once a secret has been committed.

Consequently, the primary recommended action is immediate revocation and rotation of all exposed secrets. GitHub's official guidance is to rotate or revoke exposed secrets before attempting to clean up the files containing them. An earlier bug report from August 2025 highlighting this credential storage issue was closed in January 2026 due to inactivity, not because the problem was fixed. Four related reports were all closed by the same automated bot without a reply from Anthropic. Claude Code is the only coding agent confirmed to save full approved commands in a project file by default. Malware like the Shai-Hulud worm discovered in September 2025 had already flagged over half of infected files as containing secrets. Automated secret scanners had partial success; gitleaks flagged 564 of the 1,122 secret-containing files, while TruffleHog flagged 643, with 215 files missed by both tools. To minimize future risk, security best practices dictate that standing permissions for tools should be kept as narrow as possible.

Related coverage

More from Incidents