According to research published on November 5, 2026 by security company Apiiro, Anthropic's Claude Code tool records developers' secrets in project files together with the commands they approve. Claude Code is an agentic tool that helps developers write code, and it also runs terminal commands on their behalf. The problem starts with a single choice made when approving a command — and if that file ends up in a public repository, the passwords and keys inside it become public too.
How the research was conducted
Apiiro ran the research on November 1–3, 2026, using read-only code and commit searches on GitHub. The search found 104,185 public copies of Claude Code's .claude/settings.local.json file across 103,617 repositories. Files containing secrets make up roughly 1% of all public copies — one in every hundred copies contains a secret. The researchers did not test whether the keys they found still work, but one notified company confirmed that its exposed key had been live. So it is unknown how many of the secrets found still work — the research only established that they are publicly exposed.
How secrets end up in the file
When a developer approves a shell command in Claude Code and selects "Yes, and don't ask again", the tool saves the command itself, as a rule built from the command text — including any password or API key typed into the command — in the project's .claude/settings.local.json file. That choice is meant to let the command run next time without asking.
How many secrets were found
The 1,122 files containing secrets hold a total of 1,379 distinct secrets. The largest group is database passwords — 379 of them were found. SSH logins for public servers number 43, forming a separate group. Tokens for GitHub, GitLab and npm were also counted separately — 42 tokens across the three services. AWS keys number 23. The largest group — database passwords — accounts for more than a quarter of all secrets. The files with secrets belong to 63 organizations, most of them software companies.
Why the file ended up in repositories
Claude Code tries to keep the file out of git: it adds the file to the user's global git excludes. But the tool never adds the file to the project's own .gitignore, so protection that relies on a global exclusion working on a single computer does not travel when a repository is cloned, copied, or later turned into a repository. In 539 of the 1,105 repositories traced, a commit listing Claude as co-author changed exactly this file. That is nearly half of the repositories traced.
Scanners did not catch everything
Of the files with secrets, gitleaks flagged 564 and TruffleHog flagged 643, while neither flagged 215. The 215 unflagged files make up nearly a fifth of the files with secrets. Gitleaks flagged nearly half of the files with secrets, and TruffleHog flagged more than half — each of them missed every second file. Most of the unflagged files were passwords typed inside commands, so the widely used open-source secret scanners Gitleaks and TruffleHog could not detect them.
A broader count
Counting older git history, the shared .claude/settings.json file and saved agent chat logs as well, the total reaches 2,539 secrets across 1,994 repositories. This broader count covers nearly twice as many secrets as the main count. Apiiro's research compared 16 coding agents in total. According to Apiiro's comparison, Claude Code turned out to be the only agent confirmed to save the full approved command in a project file by default.
What this means
This behavior was first reported in August 2025 in a GitHub bug report. All four related reports on the issue were closed by an automated bot without a reply from Anthropic — the company did not answer them. Although more than a year has passed, research conducted in November 2026 found more than a thousand files containing secrets on GitHub — so the problem persisted even after the reports. According to an Ars Technica article, Boris Cherny, who leads Claude Code, said the team is looking into ways to prevent the problem:
«Boris Cherny, who leads Claude Code, said the team is looking into ways to prevent the problem.»




