The most important file in ~/.claude is not a model output. It is the log of what you clicked.

The mechanism, precisely

Ask a coding agent to check a database or call an API. The command it proposes carries the secret, because it cannot work without it. Claude Code asks before it runs a shell command, several times a session, and after the tenth interruption most people stop reading the command line. Pick "Yes, and don't ask again" and two things happen: the command runs, and Claude Code appends a permission rule to .claude/settings.local.json in the project folder — so it never asks about that command again. The rule that gets stored is the command string itself.

The storage format has no redaction step. A password typed after PGPASSWORD= stops being a password and becomes a substring of an approved-permission entry. The file is the transcript of every convenience decision you made this week, held in a format indistinguishable from a config file, inside a directory whose contents get committed with everything else.

Apiiro's report, published November 5, establishes what has escaped through that door. The full accounting, with the mechanism it hangs on:

Why the file is on GitHub at all

Claude Code does try to keep the file off the internet, and the failure is specific enough to learn the shape of. When it creates the file inside an existing git repository, it adds the path to the developer's global git ignore list. That covers the common case and exactly three others fail around it, each an ordinary workflow rather than a mistake:

  • a folder that only later becomes a git repository — git init after the fact writes a repo around a file the global list was supposed to protect, but nothing in the project's own .gitignore carries the rule with the project;
  • a clone onto another machine — global ignore lists are per-machine and do not travel;
  • a file that has already been committed — and here Claude Code's own documentation is the second finding: a tracked copy of the settings file is treated as repository-supplied configuration, and the debug log records the reason plainly: "is tracked in the index; gitignore rules do not apply to tracked files." The user isn't told. The next "don't ask again" writes into the tracked file like any other tracked file.

Then the file gets committed. In 539 of the 1,105 secret-bearing repos Apiiro traced for authorship, a commit co-authored by Claude itself moved the file — models from Sonnet 4.5 to Opus 5.5 named as co-author. Claude Code's commit instructions tell the model not to commit .env or credentials.json. Its own settings file is not on that list.

The census

Apiiro collected from read-only GitHub code and commit search on default branches, November 1–3, 2026, splitting each query under the 1,000-result code-search cap until every slice fit — no credential was used or tested, no host contacted, every organization case verified at a commit-pinned link. The results:

  • 104,185 public copies of .claude/settings.local.json, in 103,617 repositories.
  • 1,122 files (1.1%) hold one or more real secrets — 1,379 distinct secrets in them: 636 provider-format keys, 743 passwords or tokens sitting next to a public host.
  • The break-open details: 379 database passwords, 122 Supabase service-role keys, 103 Supabase account tokens (control of every project in the account), 43 SSH logins to public servers including root passwords in sshpass commands, 42 GitHub/GitLab/npm tokens, 23 AWS keys, 6 private keys. One university repo permanently approved a root SSH command to a public server.
  • The rate scales with the allowlist: roughly one file in ten over 8 KB holds a real secret, against fewer than one in five hundred under 500 bytes. The file grows by exactly the mechanism it is named for.
  • Beyond the file as it exists today: 734 more secrets in 509 repos appear only in earlier versions of the file (usually because the file was later deleted — git history is the copy nobody deletes), and 211 forks of 74 secret-bearing repos carry the same secrets. In the median repo the file was first committed 217 days before the census; in 118, more than a year.
  • Counting the shared settings.json commits, the agent chat transcripts stored in repos, and the history layer: 2,539 distinct real secrets in 1,994 repositories.

The strongest single cases, each verified at a pinned commit, belong to 63 organizations — student and hackathon groups, startups, software agencies, and established vendors exposed through their own demo and workshop repos. A database vendor's own admin-level cloud API key, with manage access and no expiry claim, plus the cluster host. A production Azure Postgres password. A Square production token. The owner password of a medical-records database. The report's sentence lands exactly right and is worth keeping as the one-line description of the whole class: "Nobody meant to publish a key. The key was in a command, the command was approved, and the file was committed with everything else." One of the 63 organizations confirmed its key had been live.

What this is — and is not — evidence of

It is Claude Code's client behavior, not model misbehavior: Apiiro reproduced it with Anthropic's latest models too (Opus 5.5 and Fable 5.1), and named the agent itself as the component that stores the strings. The honest column comes in two parts.

On the other agents. Apiiro compared how 16 coding agents store approvals, from their documentation, and Claude Code is the only one confirmed to write the full approved command to a project file by default. That is a documentation read, not an audit of every tool, and it does not license the inverse claim that other agents are safe — it licenses "confirmed one, suspect the pattern." The miss class is not vendor-shaped anyway: any agent that records what it ran — transcripts, memory files, handoff notes — writes the same password-in-a-command pattern into some file, and this census found exactly that layer holding 1,160 additional secrets.

On scanners. Generic secrets scanners miss this class, measured: gitleaks flagged 564 of the 1,122 secret-bearing files, TruffleHog 643, and 215 were flagged by neither. The gap is structural: scanners look for key formats — a provider prefix, a long random string — and a human-chosen password inside a command line is an ordinary word in an ordinary command. If your defense is "the CI runs gitleaks," your defense does not cover the most common secret shape in this census.

The vendor response

Boris Cherny, Anthropic's head of Claude Code, joined the Hacker News discussion on November 7 and took part through the weekend. His commitment: the team is "looking into what we can do to prevent this," with approaches it plans to prototype — "making sure auto mode catches this, building in basic secret scanning" — and when a reader noted the same file collects secrets in auto mode, answered "good catch." As of November 8, nothing had shipped. Credit where it is due and honesty where it is due: the response was engaged and fast by the standards of this ledger, and it is also a promise, not a fix. Rotation deadlines do not wait for roadmap.

This site has been tracing this product line since October, from a different angle each time. The OVHcloud CLI swap and the trojanized Cursor-marketplace extension were a supply chain failure: the artifact you pinned was rewritten in place. This one is the opposite failure mode: the artifact is genuinely faithful, and that fidelity is the problem — the file is an honest transcript of what you approved, which is precisely the reason it must not be world-readable. Same trust question, two channels: what does your tooling hold in trust for you, and under what default.

The operator section

Four questions in this order, and one rule about the order:

Is it public? Search your organization for both filenames — .claude/settings.local.json and .claude/settings.json. Each hit is a file anyone can read right now.

Was it ever committed? Search each repo's git history for the paths, not just the working tree. If history has them, so does every fork and every clone. git log --all -p -S '.claude/settings.local.json' across your mirrors is the thorough version, per repo git log --follow -- .claude/settings.local.json is the fast one. Deleting the file going forward does nothing to the history layer — the 734-secret class exists because files were deleted and the history stayed.

What's in it? Open every copy on your own machines and read the allow list the way it should be read: each entry is a command you approved, with whatever was typed into it. Look for PGPASSWORD=, sshpass -p, mysql -p, -u root, Bearer, connection strings, psql -h.

Found something: rotate first, clean up second. The order is the whole rule. Rotation is effective against everyone including people who already read the file; a history rewrite or a deletion protects against nobody who read it in the meantime, and it lulls you into believing the leak is closed. Rotate the database password, the Supabase keys, the AWS keys, the SSH logins; then redact and rewrite history, and only if you additionally care about the artifacts.

Beyond this one file, the transferable habit for a small infrastructure team running agents: treat every agent-generated record of executed commands — allowlist caches, transcripts, memory files, handoff notes inside repos — as a secrets-at-rest surface with the same threat model you give .env. And treat "the scanner is running" as false comfort for password-shaped secrets: on your own files, the cheapest control is a grep over your own artifacts for the command-embedded passwords the scanners' formats do not know about, because the agent that wrote one down wrote it where you can look.

Rotating costs minutes. The alternative costs the medical-records database.

Sources: Apiiro, "Coding Agents Copy Your Secrets to a Hidden File. Thousands Are on GitHub", Shmulik Cohen and Matan Giladi, November 5, 2026 (numbers and quotes; method and limits sections for the read-only collection terms and the independent-review classification); heise security (November 9, 2026); Anthropic Claude Code's permissions documentation for the tracked-file behavior; Boris Cherny's November 7 Hacker News engagement via the Apiiro update of November 8.