Back to all articles
Secretus
9 min4 sources

2,539 Real Secrets in 1,994 Public Repositories: What the Coding Agent Writes to the File Nobody Reads

Apiiro searched public GitHub for the file where Claude Code stores commands approved with "don't ask again". It found 104,185 copies, 1,122 of which hold at least one real secret: database passwords, cloud keys, tokens, SSH logins. The mechanism is not a breach. It is an option you click when you are in a hurry.

A developer asks the coding agent why authentication is failing on staging. The agent proposes a command, and the command carries the database password, because it cannot work without it. The agent asks before running it. For the tenth time in the same session, the developer picks "Yes, and don't ask again".

At that moment the exact command, password included, becomes a permission rule in a file inside the project folder. Nothing in the repository marks that file as private, so it is committed along with the rest of the code. On 5 November the security company Apiiro published the count: 2,539 real secrets across 1,994 public GitHub repositories.

02

The figures Apiiro published

  • 104,185 public copies of .claude/settings.local.json across 103,617 repositories. Of those, 1,122 (1.1%) hold at least one real secret, 1,379 distinct secrets in total.
  • More than a third open a database directly: 379 database passwords, 122 Supabase service-role keys and 103 Supabase account tokens, which control every project in the account.
  • The rest include 43 SSH logins for public servers, 42 GitHub, GitLab and npm tokens, 23 AWS keys and 6 private keys.
  • File size predicts risk: one in ten files over 8 KB holds a real secret, against fewer than one in 500 under 500 bytes. The longer you keep clicking "don't ask again", the more the file accumulates.
  • Age: on 2 November every file with a secret was still on its repository's default branch. In the median repository it had been committed 217 days earlier. In 118 repositories, more than a year earlier.
  • Deleting does not fix it: earlier versions of the file hold 734 more real secrets across 509 repositories that appear in no current copy. And 211 forks of 74 repositories carry the same secrets.
  • Not only the local file: 298 of 76,011 copies of the shared .claude/settings.json, which teams commit on purpose, hold a real secret. They also appear in agent chat transcripts, in memory files and in handoff notes, a third of which were written by the agent itself.
  • 63 organisations are affected, from student groups to software agencies and established vendors. Among the strongest cases: a database vendor's own admin-level cloud key, a production Azure Postgres password, a Square production token, and the owner password of a medical-records application's database. One organisation confirmed its key had been live.
03

The mechanism belongs to the tool, not the model

Claude Code asks for confirmation before running most shell commands. When you pick "Yes, and don't ask again", it adds a permission rule to .claude/settings.local.json. Sometimes the rule is a pattern, for example every command starting with npm test. Sometimes it is the exact command, and then any password or token typed into it is saved in plain text.

Apiiro stresses that this is the product's behaviour rather than the model's: they reproduced it with the current models too. The distinction matters, because it is not fixed by switching models or rephrasing the request.

The tool does try to keep the file on the developer's machine: on first write inside a git repository it adds the file to the user's global git excludes. That covers the common case. It does not cover a folder that becomes a repository later, a clone on another machine, or a file that was already committed. The rule never reaches the project's own .gitignore, so the protection does not travel with the project.

04

Why ordinary scanners miss them

Apiiro ran gitleaks and TruffleHog over all 104,185 files, without the tools' verification step. Of the 1,122 files with a real secret, gitleaks flagged 564, TruffleHog 643, and 215 were flagged by neither.

The explanation is simple and reaches well beyond this one file. Scanners look for known key formats: a provider prefix, a long random string. A password typed after PGPASSWORD=, after sshpass -p or after mysql -p looks like an ordinary word in an ordinary command line. No format matches, so nothing fires.

And the password-inside-a-command pattern appears wherever an agent records what it ran: transcripts, memory files, handoff notes. If your scanner is tuned to key formats, it misses them in all of those.

05

What Anthropic says

Apiiro shared the research with Anthropic before publication. Boris Cherny, who heads Claude Code, replied on 7 November in a public discussion and returned with further comments over the weekend.

His position, in short: historically Claude Code has not done secret scrubbing, but the team is looking into what it can do to prevent this. He named the directions they intend to prototype, including making auto mode catch the case and building in basic secret scanning, and said they would weigh the trade-offs before shipping anything. When a reader pointed out that the same can happen in auto mode, he agreed it was a fair catch.

He also said the file is meant to stay local and that the tool adds it to git excludes when it creates it, so in his view the exposed copies were created manually and checked in. He recommended auto mode over permission rules, and enabling the secret scanning that GitHub and other hosts offer.

As of Apiiro's 8 November update, nothing had shipped. A specific product version is also circulating as the remediation milestone; it appears neither in the research nor in the quoted replies, so we do not use it.

06

Where the two accounts do not match

Anthropic says the file is automatically excluded when the tool creates it, so the public copies would have been created manually. Apiiro answers with a figure: in 539 of the 1,105 repositories with a real secret that they traced, the file was changed by a commit on which Claude is listed as co-author.

The researchers are fair here too: the figure does not prove the agent pushed every credential, only that the file often reaches history through commits made with the agent. They add one documented detail: once the file is already tracked by git, ignore rules no longer apply, and the user is not told. The next approval is appended to the tracked file.

For you as an organisation, the disagreement changes nothing practical. The file exists on laptops, sometimes in repositories, and its contents must be treated like a .env file.

07

The right order: rotate first, clean up second

  • Search your GitHub organisation for .claude/settings.local.json and .claude/settings.json. Each hit is a file anyone can read right now.
  • Check each repository's git history for those files, even where they no longer exist today. If history has them, so does every fork and every clone.
  • Rotate every password, token and key the files have ever held. Deleting the file does not clear history, forks or clones, which is why rotation comes first and cleanup second.
  • Untrack the file from git and add it to the repository's own .gitignore, not only to one machine's global excludes.
  • Open the file on your own computer, even if it was never committed, and delete every rule containing a secret. A secret approved once stays there until someone removes it, long after the command ran.
  • Change the habit: stop typing secrets into commands. Reference them as variables from a secrets manager, so the rule records the variable name rather than the value.
  • Approve patterns, not literal commands. A rule covering a class of commands has no secret to record.
08

What the security team does

  • Treat agent folders - .claude, .cursor, .gemini, .specstory - and agent memory files as secret-bearing, exactly like .env. On laptops as well as in repositories.
  • Add them to pre-commit and CI secret scanning, including history. Check explicitly that the scanner catches passwords inside commands, not only key formats.
  • Put .claude/settings.local.json into the organisation's .gitignore templates, so the protection exists from day one of every new project.
  • Triage credentials that sit next to a public server address first: those are the ones that give access.
  • Remember that most of these files never reach GitHub. The file can leave in a published npm package, a container image, an archive, or a cloud-synced folder.
  • The precedent already exists: in September 2025 the Shai-Hulud worm downloaded a secret scanner and ran it over victims' files, and malicious packages instructed locally installed coding agents to search the disk for secrets.
09

What the research does not show

  • Whether the secrets still work. Apiiro did not test the credentials; a single organisation confirmed that its own was live.
  • Whether anyone used them. There is no evidence of exploitation in these cases, and the researchers claim none.
  • The totals were not independently verified. Outlets that covered the research said so explicitly, and Apiiro sells security products for coding agents, so it has a commercial interest in the subject.
  • The comparison with other agents is based on documentation, not testing: of 16 coding agents reviewed, Claude Code is the only one confirmed to write the full approved command to a project file by default. Absence from documentation is not absence of the behaviour in the others.
  • The history count is a floor, not a total: it covers 43,120 repositories, not all of them.
  • The problem is not new. Users reported the mechanism in public issues from August 2025. According to Apiiro none received a reply, and three were closed automatically as inactive or duplicate.

Sources and verification

Open the original sources for context, updates and the exact wording of claims.

AWARELY Intelligence

Continue reading

View all articles