Subscribe
0%
Illustration for: Claude Code's 'don't ask again' saved passwords into 1,122 public GitHub files. How to check yours and clean up

Claude Code's 'don't ask again' saved passwords into 1,122 public GitHub files. How to check yours and clean up

Apiiro found database passwords, SSH logins, cloud keys and tokens in Claude Code's per-project permissions file across public GitHub, 2,539 secrets in all once history and related files are counted. Common scanners missed about one in five of the leaky files, so a clean scan is not proof you're safe.

Listen to this article0:00 / 5:01

Security firm Apiiro says Claude Code's "Yes, and don't ask again" button has quietly written live credentials into public GitHub repositories. When a developer approves a shell command that way, Claude Code saves an allow rule to .claude/settings.local.json in the project, and if the approved command contained a password or token, the secret is stored in that file in plain text. Apiiro found 1,122 public copies of the file holding at least one secret, according to The Hacker News, which reported the research on November 7.

Why it matters: the file is meant to stay on your machine, but Apiiro says it ends up committed far more often than developers assume, and the secrets inside often look like ordinary text to the scanners teams rely on. If you or your team use Claude Code, this is worth a ten-minute check today.

How the secret gets there

Approving an exact command, for example one with PGPASSWORD=..., sshpass -p ... or mysql -p... in it, stores that full command string. Pattern rules such as npm test * don't carry a secret.

Claude Code does try to keep the file out of git: on first write it adds it to the user's global git excludes. Apiiro says that protection fails in common cases, as summarized by The Hacker News and Let's Data Science:

  • the file was already committed before the exclude existed;
  • the folder became a git repo later, or the project was cloned to another machine (the global exclude doesn't travel with the project);
  • the rule is never added to the project's own .gitignore.

In 539 of 1,105 repositories Apiiro traced, a commit with Claude listed as co-author changed the file.

The numbers

Finding (per Apiiro, via The Hacker News) Count
Public copies of settings.local.json 104,185 in 103,617 repos
Copies with at least one secret 1,122 (about 1.1%)
Distinct secrets in those copies 1,379
Database passwords 379
SSH logins 43
GitHub, GitLab or npm tokens 42
AWS keys 23
Extra secrets only in older file versions 734, in 509 repos
Total incl. history, shared settings.json and agent chat logs 2,539 secrets in 1,994 repos
Organizations among the owners 63

Apiiro did not test whether the secrets still work, though one company it notified confirmed its key was live. Every file with a secret was still on its repo's default branch when the research was done, and in half of those repos it had sat there at least 217 days. The shared, intentionally committed .claude/settings.json also leaked: secrets turned up in 298 of 76,011 copies, mostly in allow rules. Forks spread the problem further, with 211 forks of 74 repos carrying the same secrets.

Let's Data Science reports that Apiiro reproduced the behavior with Opus 5.5 and Fable 5.1. And of 16 coding agents whose documentation Apiiro compared, Claude Code was the only one confirmed to save the full approved command in a project file by default, according to The Hacker News.

Scanners missed a fifth

Of the 1,122 leaky files, gitleaks flagged 564 and TruffleHog flagged 643; neither flagged 215. Most misses were passwords typed inside commands, which don't match the known key formats those tools look for, The Hacker News reports.

What Anthropic has said

Nothing public so far. Both outlets report no response from Anthropic, and say a bug report describing the behavior, filed in August 2025, was closed as "not planned" by an automated bot in January 2026.

What to do

Developers using Claude Code

  1. Search your repos, including git history, for .claude/settings.local.json and .claude/settings.json. A quick local check: git log --all --oneline -- .claude/settings.local.json shows whether the file was ever committed.
  2. Rotate first, clean up second. Deleting the file doesn't remove it from history or forks, so treat any secret it ever held as exposed.
  3. Stop tracking the local file and ignore it per project:
git rm --cached .claude/settings.local.json
echo ".claude/settings.local.json" >> .gitignore
  1. Delete any allow rule that contains a secret, even in uncommitted local files.
  2. Pass secrets as environment variables from a secrets manager (for example $DB_URL) rather than typing them into commands, and approve patterns such as Bash(npm run:*) instead of one-off commands.

Security teams

  • Treat agent folders (.claude/, .cursor/, .gemini/, .specstory/) and agent memory files as secret-bearing.
  • Extend pre-commit and CI scanning to full git history and to passwords embedded in commands, not just known key formats.
  • Add the local settings file to your organization's .gitignore templates.
  • Prioritize rotating credentials for servers reachable from the internet.

What to watch

Whether Anthropic changes the default, for example by storing approvals outside the project folder or writing the ignore rule into the repo's own .gitignore. Until then, the cleanup is on users.

Sources

  1. The Hacker News — Claude Code's "Don't Ask Again" File Exposes Passwords and Keys in 1,122 Public Copies on GitHub thehackernews.com
  2. Let's Data Science — Apiiro finds Claude Code approvals leaking 2,539 secrets on GitHub letsdatascience.com

#Claude Code#Anthropic#Apiiro#secrets#GitHub#AI coding agents#credential leak