News
Claude Code approvals leaked secrets to public GitHub
Security firm Apiiro reported in November 2026 that credentials were turning up in public GitHub repositories because of how an AI coding agent saves approved commands. The reported number is large, 2,539 credentials, and the cause is ordinary: a convenient setting, a file that was not ignored, and a secret typed straight into a command. This post summarises what was reported, flags what we could and could not check, and gives you a ten-minute routine to see whether your own repositories are affected.
Published · 6 min read
Key takeaways
- Apiiro, as summarised by Aviatrix, reported 2,539 credentials exposed across nearly 2,000 public repositories.
- The reported cause is a saved approval that stores the whole command, including any secret typed into it.
- A secret in a command, file or transcript is a secret in your history. Rotate anything you find.
- The long-term fix is to stop secrets being typed into commands at all.
What was reported
The story put Claude Code security on many teams' agendas, so it is worth reading carefully.
In November 2026, Apiiro researchers disclosed that AI coding assistants, most notably Anthropic's Claude Code, were associated with credentials being committed to public GitHub repositories. Security vendor Aviatrix published an analysis on 10 November 2026 that cites Apiiro as its source (Aviatrix).
An important note on sourcing: we could read the Aviatrix summary but not Apiiro's own write-up, so the figures below are Apiiro's as relayed by Aviatrix, and Aviatrix sells security products. Treat the numbers as reported, not independently confirmed.
According to that summary:
- 2,539 credentials were exposed, across nearly 2,000 public repositories and 63 organisations.
- 1,379 distinct secrets were found in the agent's settings files alone, split between provider-specific keys and passwords or tokens.
- The types included cloud API keys, production database passwords, payment tokens and SSH root credentials.
We did not find a statement from Anthropic in the sources we could load, so we say nothing here about its response. Check its documentation for the current behaviour.
How it reportedly happened
The mechanism is the useful part, because it applies beyond one tool. When a developer approves a command with the "Yes, and don't ask again" option, Claude Code saves that command to a hidden local settings file, .claude/settings.local.json. If the command had a secret typed into it, the secret is saved too.
The file was meant to stay local, but it was reportedly excluded through the developer's own Git configuration rather than the project's .gitignore. So when a project was cloned or shared, the file could be committed and pushed, and from there indexed in public.
None of that needs a bug in the usual sense. It is a chain of reasonable defaults: remember what I approved, keep it out of Git in this one place, and let me type a password into a command. Together they leak.
It is a pattern, not a one-off
GitGuardian's 2026 report points the same way. It found that commits co-authored by Claude Code leaked secrets at 3.2%, compared with a 1.5% baseline across public commits (GitGuardian). That is one vendor's measure and says nothing about causes, but the two reports agree that agent-assisted work needs the same secret hygiene as any other, and probably more.
Agents also work fast and keep long histories: transcripts, logs, saved approvals, memory files. Every one of those is a place a secret can land.
A short checklist for AI coding agent security
Whatever tool you use, the basics are the same. Turn on GitHub secret scanning and push protection for every repository. Treat any leaked API key as compromised and rotate API keys on a schedule. Check for exposed secrets on GitHub using your host's own search. And review the agent's settings, logs and saved histories as places a secret can hide, since they are easy to forget.
Check your own repositories
This takes about ten minutes.
- Search for the file. Look for
.claude/settings.local.jsonand.claude/settings.jsonin every repository you own, including forks and old projects. - Look inside. Search for passwords, tokens and keys in saved command strings.
- Check history as well as the current files. Use your code host's secret scanning, and search old commits.
- Untrack and ignore. Run
git rm --cachedon the file and add it to the project's.gitignore, so it cannot be committed again. - Rotate anything you find. A secret in Git history is exposed even after deletion, so revoke it and issue a new one.
- Scan agent files in CI. Treat configuration, working folders and saved transcripts as places that can hold secrets.
Who is most at risk
It is reasonable to expect experienced developers to have secret scanning, ignore files and review habits that catch this early. The people more likely to be caught out are those who have started building with agents without having built that muscle: founders making a first product, designers wiring up a database, students sharing a project for a class. They are also the people most likely to paste a password straight into a command because nothing told them not to. If that sounds like you, the checklist above matters more, and so does the habit in the next section.
What to change in your habits
| Habit | Why it leaks | Better habit |
|---|---|---|
| Typing a password into a command | The command is saved and logged | Read it from an environment variable or secret store |
| Approving "don't ask again" on commands with secrets | The secret is saved with the rule | Approve once, or rewrite the command first |
| Relying on local Git excludes | They do not travel with the repo | Ignore agent files in the project's own ignore file |
| Pasting keys into the chat | The transcript keeps them | Use a broker so the agent never holds the key |
| Never rotating | Old leaks stay valid | Rotate on a schedule and on suspicion |
A worked example
This is an illustrative scenario. A developer, Sam, asks an agent to test a staging database. The agent proposes a command with the connection string in it, password included. Sam approves it with "don't ask again", to save clicking.
Three weeks later Sam shares the project with a colleague by pushing it to a public repository. The settings file goes with it. The database password is now in the repository, along with the host name.
Done differently, Sam keeps the password in an environment variable and the command refers to it. Better still, the agent calls the staging API through a broker that holds the credential, so no password appears in a command, a file or a transcript. Our post on AI agent API key security compares those options.
What it means for SecretPigeon users
SecretPigeon is not a scanner and will not find leaks for you. What it offers here is a way to avoid creating them: a grant lets an agent call an API without ever holding the key, and a burning link means a handover does not leave a copy in chat. If you are weighing those options, see how to give an AI agent API access, and for the wider data see our study of 2026 leak figures.
Questions people ask
Does Claude Code's settings.local.json contain secrets?
It can. Apiiro, as relayed by Aviatrix, reported that approved commands are saved to this file, so a secret typed into an approved command is saved with it. Check any file you have and rotate what you find.
Should I click "don't ask again" in Claude Code?
Not for commands that contain a secret. Approve those once, or rewrite them to read the secret from an environment variable or a store, so the saved rule holds no password.
How do I check my repos for leaked secrets?
Use your code host's secret scanning, search for agent settings files and their history, untrack them, and rotate any credential you find.
Is this only a Claude Code problem?
No. The same risk applies to any tool that records commands, transcripts or memory. GitGuardian's 2026 report found higher leak rates in commits assisted by AI tools generally.