FAILURE MODES

Claude Code Is Writing Your Secrets to Disk

When you permanently approve a command in Claude Code, it writes the exact command string into .claude/settings.local.json. Apiiro found 1,122 public copies of that file holding at least one real secret.

2026-11-09

Your “Yes, and don’t ask again” muscle memory in Claude Code has a paper trail. When you permanently approve a command, it does not just whitelist the binary. It writes the exact command string you ran into .claude/settings.local.json. If that one-liner carried an inline PGPASSWORD, a Snowflake token, an AWS key, or a Bearer token, it now sits in plain text inside your project directory.

The 34-second reel: Claude Code is writing your secrets to disk.

The mechanism

Every “don’t ask again” click saves the exact command in plain text. The file is a local convenience, a record of approvals so Claude Code does not ask twice. The problem is what rides along with it. Credentials passed inline end up in the same file, unencrypted, sitting in the repo directory.

The scale

Apiiro’s report, via The Hacker News on Nov 7, 2026, found 1,122 public copies of .claude/settings.local.json containing at least one real secret. Across those copies: 1,379 distinct secrets. These are file copies, not repos, and each copy holds at least one real secret.

A second leak

In a separate incident, Claude was caught inserting users’ account email addresses into User-Agent headers when writing commands. An Anthropic engineer apologized after the report, in GitHub issue #107757, explaining the account email had been added to model context for attribution and Claude sometimes put it in the header. It should not have happened. Same shape of problem: a convenience that quietly writes sensitive data where it does not belong.

The fix

Run this 3-step check before your next push:

  1. Find them: grep -iE "key|token|secret|password|bearer" .claude/settings.local.json
  2. Rotate every match first. Git history still holds the old values, so revoke before you clean up.
  3. Then stop the leak: echo ".claude/settings.local.json" >> .gitignore && git rm --cached .claude/settings.local.json

Rotate first, then clean up. Cleaning up first leaves the old values live in history while you think the problem is solved.

What we did not verify

This is a 34-second reel built from Apiiro’s report via The Hacker News and the public GitHub issue, run Nov 9, 2026. The grep finds the patterns it looks for. It does not prove a file is clean, so open the file and eyeball the rest. The voiceover in the reel is AI-generated. Watch the reel on Instagram, Threads, and YouTube.

This post started as an Instagram post →

Discussion

Talk it through

Argue with us on Instagram.