A convenience feature built into Anthropic’s Claude Code, the company’s AI coding assistant, has been quietly leaking passwords and API keys onto the public internet. Security research firm Apiiro found that more than 1,100 public GitHub repositories contain at least one real secret sitting inside a configuration file the tool creates by default.
How a time-saving shortcut backfired
Claude Code normally asks permission before it runs a shell command on a developer’s behalf. To cut down on repeated prompts, it offers a “Yes, and don’t ask again” option. Choosing it tells Claude Code to remember the command so it can run automatically next time, and that memory is stored in a project file called .claude/settings.local.json.
The problem, according to Apiiro, is what gets written into that file. When a developer approves an exact command rather than a general pattern, Claude Code saves the command word for word, including any password, token, or key typed directly into it. Claude Code does add the file to the user’s personal global git exclude list, but it never adds the file to the project’s own .gitignore, and that protection does nothing for a file that has already been committed to a repository’s history. Apiiro’s researchers also found that in 539 of the 1,105 repositories they traced, a commit credited to Claude itself had modified the file.
The scale of the exposure
Apiiro says it located 104,185 copies of the settings file across 103,617 public GitHub repositories. Of those, 1,122 copies, roughly one in every ninety, contained at least one working secret, adding up to 1,379 distinct exposed credentials. Counting other places secrets turned up, including shared team settings files, older versions of the file, and saved agent chat logs, the researchers put the broader total at 2,539 secrets across 1,994 repositories, with 734 more found only in older file versions across 509 additional repositories. The same credentials showed up again in 211 forks of 74 repositories, and the exposed files were traced back to 63 different organizations.
More than a third of the leaked secrets would allow direct access to a database, including 379 separate database passwords. Researchers also catalogued 43 SSH logins for public-facing servers, 42 access tokens for GitHub, GitLab, and npm, and 23 AWS access keys. Apiiro singled out two particularly serious examples: an administrator-level cloud key belonging to a database vendor, and the owner password for a database holding medical records. By the time the research was published, every file containing a secret was still sitting on its repository’s default branch, and half of them had been exposed for at least 217 days.
Apiiro says it did not test whether the leaked secrets still work, since doing so would mean using credentials without authorization. However, at least one company that was notified confirmed that its exposed key was still live. It remains unconfirmed whether any of the secrets have actually been used by an attacker.
Anthropic has not responded
Apiiro reports that a bug report describing this exact behavior was filed in August 2025. It was closed roughly 60 days later by an automated bot as “not planned,” and four follow-up reports on the same issue, the most recent filed the day before Apiiro’s research was published, received the same automated closure with no reply from Anthropic. As of publication, Anthropic had not issued a public response to the findings.
Apiiro also compared 16 different AI coding agents and says Claude Code is the only one it confirmed saves a fully approved command, secrets included, into a project file by default.
What developers should do
Apiiro’s recommendations are straightforward but important for anyone using Claude Code or a similar tool. Any credential that may have been typed into an approved command should be treated as compromised and rotated immediately, since simply deleting the file afterward does not undo an exposure that may already be public. The settings file itself should be removed from git tracking and added to the project’s .gitignore, and any copies already in the repository’s history should be scrubbed as well. Longer term, developers are better off keeping secrets out of commands entirely, pulling them from environment variables or a dedicated secrets manager instead, and approving broader command patterns rather than one-off exact commands that might contain sensitive values. Apiiro also noted that common secret-scanning tools missed 215 of the 1,122 exposed files, so organizations relying on automated scanning to catch this kind of leak should check that their tooling actually looks inside command history files.
This is not the first time an AI coding assistant has exposed sensitive data through its own working files. We previously covered how AI coding tools leaked over 13,000 internal screenshots to public GitHub repositories back in September 2026, a separate incident that also traced back to assistants saving local working data without enough thought for what ends up in a public repository.
Source: This article is based on reporting by Swati Khandelwal for The Hacker News, drawing on original research published by Apiiro.

