One Click in Claude Code Saved Production Passwords to a Project File, and 1,122 Copies Are Now Public on GitHub


The button remembers the whole command, including the password

Every coding agent asks for permission before it runs a shell command. Ask Claude Code, Anthropic’s terminal coding agent, to check why a staging database login is failing, and the command it proposes will often carry the password or token it read from your config.

On November 5, security firm Apiiro published research by Shmulik Cohen and Matan Giladi showing that when a developer picks “Yes, and don’t ask again,” Claude Code saves that exact command, word for word, as an allow rule in a file called .claude/settings.local.json, inside the project folder. If the command contained a password, the password is now in that file, in plain text.

That file is meant to stay on one laptop. In more than a thousand cases, it did not.

The count: 1,122 files, 1,379 secrets, 63 organizations

Apiiro collected public GitHub data between November 1 and November 3, using GitHub code search. It found 104,185 public copies of .claude/settings.local.json, spread across 103,617 repositories. Of those files, 1,122, about 1.1 percent, hold at least one real secret: a credential in a known provider format, or a password or token next to a host reachable from the public internet. It did not test any credential, so real means the shape and context look real, not that the key was proven to still work.

Inside those 1,122 files sit 1,379 distinct secrets:

  • 636 provider keys, in recognizable formats from cloud and API vendors.
  • 743 passwords or tokens tied to public hosts.
  • 379 database passwords, and 122 Supabase service role keys, which carry broad access by design.

The examples show this is not test data. They include a database vendor’s own admin level cloud key, a production Azure Postgres password, a Square production token, and the owner password for a medical records app’s database. In total, 63 organizations hold a real secret in a public allowlist file, most of them software companies. One company Apiiro contacted confirmed that its leaked key had been live.

Counting older versions in git history, the shared settings file teams commit on purpose, and saved agent chat transcripts, Apiiro puts the full count at 2,539 distinct secrets in 1,994 repositories.

Why a file that is supposed to stay local keeps getting published

Claude Code does try to keep this file out of version control. Its settings documentation says that the first time it writes the file inside a git repository that does not already ignore it, it adds the pattern **/.claude/settings.local.json to the developer’s global git excludes file. In the common case, that works. The failures sit in the gaps around that safeguard:

  • The protection goes into a global excludes file on one machine, not into the project’s own .gitignore, so a clone on another computer, or a teammate’s machine, may have no such rule.
  • A folder that becomes a repository later, or a file that was already tracked before the safeguard applied, can carry the file into history.
  • Approvals are sometimes written to the shared .claude/settings.json instead, a file teams commit deliberately. An open bug report on Claude Code’s own tracker describes that behavior, and Apiiro found secrets in 298 of 76,011 public copies of that shared file.
  • In 539 of the 1,105 leaking repositories Apiiro traced, a commit co-authored by Claude itself had changed the settings file.

Once committed, time does the rest. In the median leaking repository, the file was first committed 217 days before Apiiro’s November 2 snapshot. Most of these files have been public, and searchable, for months.

Deleting the file does not fix it

Removing the file from the current version of a repository does not remove it from git history, and it does not touch forks or clones. Apiiro found another 734 secrets in 509 repositories sitting only in older versions of the file, where someone had deleted the file but left its history intact, and 211 forks carrying the same secrets. Any credential that has ever been in a public commit has to be treated as known to anyone who cared to look. The remedy is rotation: change the password, revoke the token, issue a new key.

The local copy matters too. The file sits in plain text on every laptop where a developer clicked that button, and credential-stealing malware already sweeps developer machines for exactly this kind of store.

Standard scanners miss one in five of these files

Most companies run a secret scanner and assume the problem is handled. Apiiro ran two standard tools, gitleaks and TruffleHog, over all 104,185 files. Of the 1,122 files holding a real secret, gitleaks flagged 564 and TruffleHog flagged 643. A total of 215 files, about one in five, were flagged by neither.

Scanners are good at spotting a key in a recognizable format. They are much weaker when the secret is an ordinary password typed inside an ordinary command, after PGPASSWORD=, or in an sshpass -p or mysql -p call, or in an authorization header inside a curl command. A password in a command line looks like a word in a command, because that is what it is. Any audit that relies on scanner output alone will undercount this failure.

Not the model, the tool around it

Apiiro is careful about where the fault sits. This is, in its words, Claude Code’s own behavior, not the model’s. The researchers reproduced it with Anthropic’s latest models, including Opus 5.5 and Fable 5.1, because the saving is done by the harness that wraps the model. Of 16 coding agents whose documentation Apiiro compared, Claude Code was the only one it could confirm writes the full approved command to a project file by default.

The fix is in Anthropic’s control, and it is not a research problem. A permission rule does not need to store the literal secret. It could store a pattern with the credential redacted, refuse to persist any command that appears to contain one, or keep local approvals out of project folders altogether.

The timeline adds a harder question. Developers have reported this behavior on Claude Code’s GitHub tracker since August 2025. Apiiro cites four such reports, says none received a reply from Anthropic, and says three were closed automatically as inactive or duplicates. As of November 8, the secondary coverage found no public reply from Anthropic and no change to the documentation.

Two caveats belong with the numbers. Apiiro sells security products for coding agents, so it has a commercial interest in this category of risk, and no third party has repeated its count. And because it tested no credentials, the research proves exposure, not compromise: apart from the one company that confirmed a live key, nobody knows how many of the 2,539 secrets still work. Neither caveat shrinks the practical task. Exposure on public GitHub, for a median of 217 days, is reason enough to rotate first and debate the count later.

What to do today, if your team uses Claude Code

  • Search your organization now. Look on GitHub for .claude/settings.local.json and .claude/settings.json in every repository you own, and check git history, not just the current files.
  • Rotate before you clean. Change every password, token and key that either file has ever held, including in old commits and forks. Removal is housekeeping, rotation is the fix.
  • Untrack the file properly. Run git rm --cached .claude/settings.local.json where it is tracked, and add the pattern to each project’s own .gitignore, not only to a global excludes file other machines do not share.
  • Clean the local copies too. Open the settings file on your own machine and delete any allow rule that contains a secret, even if that file never left the laptop.
  • Stop approving literal secrets. Reference credentials through variables, such as $DB_URL, and approve command patterns, such as Bash(npm run:*), instead of one-off commands with the credential typed in.
  • Do not trust a clean scanner report by itself. Add a specific check for these two filenames, because general scanners missed about one in five of the leaking files Apiiro found.

The bottom line

A convenience button did exactly what it promised: it stopped asking. In doing so, it wrote production passwords and API keys, word for word, into a plain text file inside project folders, and 1,122 copies of that file are now public on GitHub, with a wider total of 2,539 secrets once history, shared settings and transcripts are counted. The safeguard meant to keep the file local depended on a global setting on a single machine, standard scanners miss a fifth of the cases, and the behavior had been reported to Anthropic since August 2025. The lesson reaches past one product. Every agent approval is a record, and teams should ask of any coding agent: when I click do not ask again, what exactly gets written down, where does it live, and who else can read it.