DriftLock

Claude Code's 'Don't Ask Again' Is Leaking Secrets to GitHub

Apiiro reported finding 1,122 public copies of Claude Code's .claude/settings.local.json file on GitHub containing plaintext database passwords, cloud credentials, API tokens, and SSH logins — 1,379 secrets in those files, according to the Cloud Security Alliance's summary of Apiiro's research. The cause is Claude Code's "Yes, and don't ask again" approval option, which saves the exact shell commands a developer approved, secrets and all, into a local settings file that then gets committed to a repository through ordinary developer habit, no prompt injection or malware involved.

What happened

Apiiro's research, first reported in November 2026 and updated November 8, describes a quiet failure mode in Anthropic's Claude Code. When a developer approves a shell command and selects "Yes, and don't ask again," Claude Code remembers that approval by writing the command — in full — into a local configuration file, .claude/settings.local.json. If that command included a database password, a cloud API key, or an SSH login typed inline, the secret goes into the file too, in plain text.

The problem surfaces when that settings file ends up in a public repository, which GBHackers reports has already happened at scale: Apiiro counted 1,122 public copies of the file on GitHub holding 1,379 secrets between them, and 2,539 across all the places it searched, including git history. Nothing exotic caused this. No attacker crafted a malicious prompt, no extension was compromised. A convenience feature designed to reduce approval fatigue simply persisted sensitive data to disk in a location developers didn't think of as a secret store, and then normal commit-and-push workflow did the rest.

Why this isn't covered by existing training

Most organizations that have rolled out AI coding assistants have some version of "don't paste secrets into the chat" guidance. That guidance assumes the risk is the conversation itself — the prompt, the response, the model provider's servers. This incident is different: the secret never had to appear in a chat message to leak. It only had to appear once in an approved shell command, get cached locally by a feature meant to reduce friction, and then get swept up when the repository was committed and pushed, which is exactly what .claude/settings.local.json does by default unless a developer has deliberately excluded it.

That's the part worth sitting with. This is a new category of secret surface — auto-saved command history and tool-approval state — that doesn't show up in a typical code review and isn't scanned by most "don't paste secrets into AI tools" policies, because the policy was written for the chat window, not the settings file sitting quietly next to it.

What to check today

If engineers at your organization use Claude Code, these are concrete, same-day actions:

  • Search your organization's repositories, public and private, for files named .claude/settings.local.json.
  • If any are found, treat every command and credential in them as compromised, and rotate the affected passwords, API keys, or SSH credentials — do not assume the file is harmless just because the repo is private.
  • Add .claude/settings.local.json to .gitignore in every repository where Claude Code is used, and confirm it hasn't already been tracked by git history (removing it from .gitignore after the fact does not remove it from past commits).
  • Extend your secret-scanning tooling to include this filename pattern specifically — generic secret scanners that look for key formats may miss a JSON settings file that wasn't built to look like a credential store.
  • Ask engineering leads whether "don't ask again" is in routine use, and if so, whether the team understands that it writes approved commands to disk.

What DriftLock does about this, and what it doesn't

DriftLock is a desktop app for macOS and Windows that runs alongside the AI assistants and coding agents your staff already use — Claude Code, GitHub Copilot CLI, Cursor, VS Code, Windsurf, Claude Desktop, and AI features in Chrome, Edge, and Brave — and a Console that lets security teams set policy once and apply it across every laptop in the company. For a story like this one, the relevant job is watching what an agent is about to do locally and flagging risky patterns, like a shell command carrying what looks like a live credential, before that approval gets cached or that file gets committed, and giving IT a consistent, company-wide view of which machines are running which agents with which settings.

What it does not do is rewrite or patch Claude Code itself, guarantee that every secret-bearing command will be recognized before approval, or stop a developer who deliberately commits a file against policy. No tool, DriftLock included, closes every gap a convenience feature like "don't ask again" can open, and this kind of leak — a legitimate tool persisting real data to an unexpected location — is a different problem than prompt injection, with different detection challenges. The honest framing is that DriftLock adds a layer of local visibility and company-wide policy that didn't exist before, not a guarantee that this specific failure mode can never recur.

DriftLock is coming soon. Join the waitlist

What to take away

  • Apiiro found 1,122 public .claude/settings.local.json files on GitHub holding 1,379 plaintext secrets, caused by Claude Code's "don't ask again" approval feature caching approved shell commands to disk.
  • No prompt injection or compromise was required — ordinary developer convenience and ordinary commit habits did the leaking.
  • Search your own repositories for this filename today, rotate anything exposed, and add it to .gitignore and your secret-scanning rules.
  • Treat auto-saved agent command history and settings files as a secret surface in their own right, separate from chat-paste policies.
  • Company-wide visibility into which agents are installed and how they're configured, not just developer-level awareness, is what catches this kind of gap before it reaches a public repo.

Sources

Related