Featured · Nov 8Technology
How Claude Code Leaked Over a Thousand API Keys
A convenience button in Anthropic's coding assistant was supposed to save developers a click. Instead it quietly turned private credentials into public records on GitHub.

Listen
Read by Wren · 9 min
A File Nobody Meant to Publish
Researchers at the security firm Apiiro scanned public GitHub for copies of a small configuration file that Claude Code creates on developers' machines, called .claude/settings.local.json1,4. They found 104,185 copies of it sitting in 103,617 public repositories. Of those, 1,122 files held at least one real secret, and together those files contained 1,379 distinct credentials1,4.
One of those credentials, Apiiro later said, belonged to a company that confirmed the key was still live when contacted7.
The file that carried all of this was never supposed to be a secrets store. It exists because Claude Code, Anthropic's command-line coding assistant, asks permission before running a shell command, and one of the options it offers is "Yes, and don't ask again," meant to spare a developer from approving the same kind of command over and over1,2,3.

According to the researchers, the implementation behind that convenience option did not simply remember that a type of command was allowed. It saved the command itself, word for word, including any password, API key, or connection string typed or generated inside it, into .claude/settings.local.json1,2,3. A developer troubleshooting a database connection, testing an API, or deploying code could approve a command containing a live credential once, click the box that promised not to be asked again, and never think about it further3.
The pattern had surfaced in smaller ways before Apiiro's scan. A GitHub issue opened in March 2026 described Claude Code telling a user it had leaked API keys from a .env file through conversation transcripts, with one key reportedly compromised afterward9. Another issue, from May 2026, described the assistant reading files like ~/.aws/credentials while troubleshooting and potentially embedding their contents in the conversation record itself10. Those reports concerned transcripts rather than the settings file Apiiro later examined, but they pointed at the same underlying habit: an agent that copies sensitive material into places that outlive the session.
What turned a local mistake into a public one was ordinary Git hygiene, or the lack of it. Claude Code does add an exclusion for the settings file to a developer's global Git ignore list when it first writes the file inside a repository, but that protection doesn't travel with the project, doesn't cover files already being tracked, and doesn't help if a folder becomes a repository later9,3. Developers committed the file along with their code, pushed it to GitHub, made the repository public, and the credential-bearing command went with it1,2,3.
Apiiro's research, dated November 5, 2026, found the problem was not confined to a few unlucky repositories6. The 1,122 files with secrets spanned 63 organizations, mostly software companies, and the credentials inside them included 379 database passwords, 43 SSH logins, 42 tokens for services like GitHub, GitLab, and npm, and 23 AWS access keys1,6,4. Other coverage of what appears to be the same research gave a larger total: 2,539 secrets across 1,994 repositories, still tied to 63 organizations5,6,7,8. The available sources don't explain whether that larger figure came from a wider scan, a broader definition of what counted as a secret, or something else; it stands as a second, unreconciled number rather than a correction of the first.
Anthropic's own handling of earlier warnings did not suggest urgency. Apiiro said four related reports filed through the company's security intake process had all been closed by an automated bot, the most recent the day before its findings were published, with none drawing a reply from Anthropic2. One report from August 2025 had been closed as "not planned" after sixty days without activity2.
The key that one company confirmed was still live sat among the rest of those 1,379 or 2,539 credentials, however many there really were, available to anyone who knew where to look on GitHub6,7. Nothing in the record says whether it, or any of the others, had already been used.
How a Permission Prompt Becomes a Leak
Claude Code is a command-line tool, first released in February 2025 and made generally available that May, that lets developers hand coding tasks to an AI agent through natural-language prompts11. Because the agent can run shell commands on a developer's machine, Anthropic built in an approval step: before running something, Claude Code asks the user to confirm1,2,3.
"Yes, and don't ask again" is one of the choices on that prompt, designed to stop the assistant from re-asking permission for commands a developer has already approved1,2,3. The researchers who examined 16 coding agents for comparison said Claude Code was the only one confirmed to save the full approved command in a project file by default, rather than a safer generalized rule2.
That project file, .claude/settings.local.json, sits inside a developer's repository folder1,3. It was built to hold permission settings, not operational secrets, but because it stores the literal command a developer approved, any password or key typed into that command rides along with it1,2,3.
What Apiiro Counted
- 104,185 public copies of .claude/settings.local.json found across 103,617 GitHub repositories1,4
- 1,122 of those files contained at least one real secret, totaling 1,379 distinct credentials1,4
- A separately reported total attributes 2,539 secrets to 1,994 repositories, also tied to 63 organizations5,6,7,8
- Breakdown of the narrower count: 379 database passwords, 43 SSH credentials, 42 tokens for GitHub, GitLab, or npm, and 23 AWS access keys1,6,4
- Half of the affected repositories kept the file on their default branch for at least 217 days; 734 additional secrets turned up in older file versions no longer in the current code, and 211 forks copied secrets from an original repository2
- 215 of the secrets evaded both gitleaks and GitHub's own secret scanning2,6
What Isn't Settled
The two headline totals, 1,379 secrets in 1,122 repositories versus 2,539 secrets in 1,994 repositories, both trace back to Apiiro's research, but the sources available here don't explain the gap1,5,6,8. It may reflect a wider scan window, a broader definition of what counts as a secret (including older file versions, shared settings files, and agent transcripts), or simply inconsistent reporting across outlets covering the same study. Treat the two numbers as competing reported totals rather than one confirmed figure.
Earlier GitHub issues describing API keys leaking through conversation transcripts, from March and May 2026, describe a related but technically distinct risk: secrets copied into chat logs rather than into the settings file Apiiro studied9,10. The sources don't establish that these were part of the same incident or chain of events as the November disclosure.
Finally, Apiiro said it did not test whether the exposed credentials still worked, with one reported exception: one affected company confirmed its key was live2,6,7. Whether any of the others were ever accessed or misused is not established by the available reporting.
Timeline
- 2025-02Claude Code is released as an agentic command-line coding tool11.
- 2025-08An earlier bug report alleging plaintext credential storage in approved commands is filed and later closed as 'not planned'2.
- 2026-03-24A GitHub issue reports Claude Code leaking API keys from a .env file through conversation transcripts9.
- 2026-05-11A separate issue describes Claude Code reading credential files during troubleshooting and embedding their contents in transcripts10.
- 2026-11-01Apiiro's scan of public GitHub repositories reportedly takes place over this period (November 1-3)9.
- 2026-11-05Apiiro's research into Claude Code's settings file exposure is dated6.
- 2026-11-07Reports publicize the 'Yes, and don't ask again' credential exposure, including figures of 1,122 affected repositories1,3.
- 2026-11-08Further coverage reports the larger total of 2,539 secrets across 1,994 repositories2.
Pictures




Sources
- Claude Code 'Don't Ask Again' Bug Exposes 1,122 GitHub Credential Files | Aviatrix Threat Researchaviatrix.ai · 2026
- Apiiro: Claude Code 'Don't Ask Again' Leaks Keys in 1,122 Repos | AI Weeklyaiweekly.co · 2026
- Claude Code's "Yes, and Don't Ask Again" Option Can Leak Passwords and API Keys to GitHubcybersecuritynews.com · 2026
- Threat-Feed AI — Intelligence Deskthreat-feed.ai
- Claude Code's “Don't Ask Again” File Exposes Passwords and ...sepe.gr
- Claude Code's "Don't Ask Again" Feature Exposes 2,539 Secrets Across 1,994 GitHub Repositoriesgbhackers.com · 2026
- Cyber Security News on X: "‼️ Claude Code's “Yes, and Don't Ask Again” ...x.com
- Apiiro finds Claude Code approvals leaking 2,539 secrets on ...letsdatascience.com
- [MODEL] · Issue #38417 · anthropics/claude-codegithub.com
- Read/cat on config files leaks API keys into conversation transcriptgithub.com
- Claude (AI)Wikipedia
Researched and written by Lorelet from the sources above. It cites as it goes, but it can still get things wrong, so check the sources for anything that matters.
Report a problem
More featured lorelets
See allToday · Food
The Turkey Surplus That Became the TV Dinner
A company drowning in frozen birds found an answer on an airline food cart, or so the story goes for fifty years.
Today · Space
Why Is Jupiter's Great Red Spot Actually Red?
Jupiter is built almost entirely of colorless gas, yet its most famous storm glows orange-red. Scientists have spent decades in the lab trying to fig…
Today · Art & Design
The Aztec Labret Whose Golden Tongue Still Moves
A small gold serpent made for a pierced lip somehow ended up with a tongue that flicks side to side. No one alive has ever seen it worn.