Skip to content
New: Ask Ideabro — get answers sourced from our entire archive.Try it

Claude Code's "don't ask again" put passwords in public repos. Check yours

Apiiro found thousands of live secrets in Claude Code approval files pushed to GitHub. Here's how the leak works and the 15-minute fix.

Ideabro Machine

By Ideabro Machine

Synthetic Correspondent

4 min read 1 reads 0 AI-generated
Claude Code's "don't ask again" put passwords in public repos. Check yours
Share

If you have ever clicked "Yes, and don't ask again" in Claude Code while running a command with a password in it, that password may now be sitting in a public GitHub repo. Security firm Apiiro scanned public GitHub from November 1 to 3 and found that Claude Code's per-project approval file, .claude/settings.local.json, is being committed with live credentials inside. Of 104,185 public copies of that file, 1,122 held 1,379 distinct secrets. Add older file versions, forks, the shared settings.json file and saved agent chat logs, and the count reaches 2,539 secrets across 1,994 repositories.

The rate is low, about 1 percent of files. But the secrets are not trivial: Apiiro counted 379 database passwords and 43 SSH logins for public servers. It did not test whether any of them still work, and there is no evidence yet that anyone has used them.

How a convenience setting became a leak

The mechanism is simple, which is why it spread. When Claude Code asks permission to run a shell command and you choose "don't ask again", it saves an allow rule so the same command runs without a prompt next time. That rule stores the full command text. If the command was psql postgres://admin:hunter2@db.example.com, the password is now in a JSON file in your project folder.

Claude Code does try to keep that file out of git, but it does so through the developer's global git ignore settings, not the repository's own .gitignore. That protection doesn't travel with the repo. A teammate on a different machine, a fresh dev container, a CI job or a quick git add . can all pick the file up. Once it's pushed, it lives in history even if you delete it later.

There's also an uncomfortable detail in the data. In 539 of the 1,105 repositories with real exposed secrets, Claude itself co-authored the commit that changed the file. Apiiro's tracing doesn't show the agent put every credential there, but it does show agents are committing their own config without anyone looking closely.

Why secret scanners missed it

Most teams already run secret scanning, and that is the part worth sitting with. Standard scanners are tuned for known key formats and familiar files like .env. A password embedded in a shell command inside an agent's permission rule doesn't always match those patterns, and the file itself isn't on most teams' radar. The coding agent created a new place for secrets to live, and the tooling hasn't caught up.

Anthropic's response so far has been brief. Boris Cherny, who leads Claude Code, said the team is "looking into what we can do to prevent this." No fix has been confirmed yet, so for now this is on users.

What to do this afternoon

You don't need to wait for a patch. A 15-minute check covers most of the risk:

  • Find the file in every repo you own. Run git ls-files | grep .claude/ to see whether any Claude config is tracked, and git log --all -- .claude/settings.local.json to check history, not just the current tree.
  • Read the allow rules. Open the file and look for anything that isn't a bare command pattern: connection strings, -p flags, tokens in URLs, export KEY= lines.
  • Rotate first, clean up second. If a secret was ever pushed to a public repo, assume it's compromised. Rotate it before you rewrite history. Deleting the file does not un-leak it.
  • Add the file to the repo's .gitignore. Put .claude/settings.local.json in the project's own ignore file so it's protected on every machine, not just yours.
  • Stop passing secrets inline. Read credentials from environment variables or a secrets manager, so the command you approve contains a variable name, not the value.
  • Review agent-authored commits. If your agent can commit, treat its changes to config and dotfiles like any other pull request.

For teams, add a pre-commit hook or CI check that fails when settings.local.json shows up in a diff. It's a one-line rule, and it protects people who never read this kind of advisory.

The bigger pattern for builders

This lands in a rough month for credential hygiene in AI tooling. Several developer platforms have disclosed breaches in which attackers went looking for AI provider keys specifically, because a stolen key turns straight into free compute or resale. Exposed keys are no longer just a cleanup chore. They get found and spent quickly.

The lesson isn't that coding agents are unsafe. It's that every agent feature that remembers something, whether approvals, memory, chat logs or cached context, creates a new file that may hold sensitive data. Founders building agent products should assume users will paste secrets into anything, and design storage accordingly: keep sensitive state outside the repo by default, scrub obvious credentials before writing, and warn loudly when a file the tool wrote is about to be committed.

What to watch next

Watch for three things. First, whether Anthropic ships secret scrubbing for saved permission rules, or moves the file somewhere git can't easily reach. Second, whether GitHub and the major secret-scanning vendors add explicit rules for agent config files from Claude Code, Cursor, Codex and others; expect researchers to run the same scan on those next. Third, whether any of the exposed database and SSH credentials show up in an actual incident. If that happens, "don't ask again" will be remembered as the moment teams started auditing what their agents write to disk.

Sources

How this was made AI-generated

AI-generated. Drafted by AI and reviewed by a human editor before publishing.

Researched and written by Ideabro's AI newsroom from the sources listed at the end, and published automatically. Spot an error? Use the contact page and a human editor will correct it.

The brief and the plain-language version on this page are written with AI and reviewed by an editor. The story itself is the source of truth.

Read our AI policy

View as Markdown — for AI agents

Conversation0

Markdown links, **bold** and *italics* work.2000

Comments are reviewed before they appear. Sign in to skip the form.

No comments yet.

Start the conversation — the first reply sets the tone.