cd ~/series/demystifying-ai
Claude Code's Don't-Ask-Again Leak
EP 58 HOT TOPIC Apiiro research Nov 16, 2026 5 min

Claude Code's Don't-Ask-Again Leak

"Yes, and don't ask again" saved full shell commands - passwords included - into .claude/settings.local.json. Apiiro found 1,122 public copies holding secrets.

Share:
// TL;DR

Claude Code can persist an approved Bash command verbatim into project .claude/settings.local.json. Secrets typed into that command become plain JSON. Apiiro found 104,185 public copies of the file; 1,122 held secrets (1,379 in those files). Protection lives in the user's global git excludes - not the repo .gitignore. Anthropic has acknowledged the issue. No shipped fix yet.

104k
Public file copies
1,122
With ≥1 secret
1,379
Secrets in those files
63
Orgs exposed

# The Leak Pipeline

This is not a remote exploit. It is a permission UX footgun that turns a convenience click into a committed secret.

01
Bash prompt

Claude asks before the command

02
Don't ask again

You click once for convenience

03
Exact command saved

Password still inside the string

04
settings.local.json

Plain JSON in the project

05
Public GitHub

History + forks keep it

Safe rules look like patterns: Bash(npm test:*). Dangerous rules look like the exact command Claude just ran - including PGPASSWORD=, sshpass -p, mysql -p, or a bearer header.

SAFE PATTERN
"Bash(npm run:*)"
"Bash(psql $DATABASE_URL *)"

No literal secret. Env var name only. Pattern covers the family of commands.

LEAK MODE
"Bash(PGPASSWORD=hunter2 psql -c 'select 1')"

Exact string. Password in plain text. One commit away from public search.

SHAPE OF .claude/settings.local.json
{
  "permissions": {
    "allow": [
      "Bash(npm test:*)",
      "Bash(curl -H 'Authorization: Bearer glpat-XXXX' ...)"
    ]
  }
}

Illustrative shape from public writeups. The red line is the failure mode.

# Why the "Protection" Failed

Claude Code does try to keep the file local. The protection is the wrong layer.

WHAT CLAUDE CODE DOES
  • →Adds path to user global git excludes when it creates the file
  • →Stays on one laptop / one user config
  • →Does nothing if the file was already tracked
WHAT ACTUALLY WORKS
  • →Repo .gitignore checked into the project
  • →Travels with clones, CI, and teammates
  • →git rm --cached if already committed

Apiiro also found Claude co-authored commits touching the file in 539 of 1,105 traced repos - so this is not only "someone manually force-added a local file."

# What Apiiro Measured

Researchers Shmulik Cohen and Matan Giladi published Nov 5, 2026. The Hacker News, Ars Technica, and GitLab covered it within days.

Scope: public GitHub search for .claude/settings.local.json, then secret-format matching plus an AI reviewer.

EXPOSURE FUNNEL
104,185 public copies 103,617 repos
1,122 with secrets ~1.1%
1,379 secrets in those files
2,539 broader + history / logs
SECRET TYPES IN LOCAL FILES (TOP COUNTS)
Database passwords 379
SSH logins to public hosts 43
GitHub / GitLab / npm tokens 42
AWS keys 23

Bar widths relative to 379 (DB passwords). Nearly three in ten secrets in those files were database passwords.

SCANNER COVERAGE ON 1,122 SECRET FILES
564
gitleaks
643
TruffleHog
215
neither caught

Misses were mostly passwords buried inside command strings - exactly the don't-ask-again shape.

211
forks still carrying secrets
74
source repos forked
734
secrets only in history
217d
median age (half of hits)

Apiiro did not live-test credentials. Treat the dataset as an exposure census.

One notified company confirmed a key was still live. Every secret-bearing file Apiiro checked was still on the default branch.

# Not Just Another Secret-in-Repo Story

Of 16 coding agents Apiiro compared, Claude Code was the only one confirmed to save the full approved command into a project file by default.

User reports of this pattern go back to August 2025. The Nov 2026 research made the scale public.

ANTHROPIC STATUS (MID-NOV 2026)
!

No shipped product fix for this persistence path.

~

Boris Cherny (Claude Code lead) on HN: team looking into prevention; plans to prototype auto-mode catch + basic secret scanning - no date.

i

Anthropic advice: prefer auto mode and host secret scanning. Apiiro notes auto mode can still leave secrets in the file.

# What To Do Tonight

Order matters. Rotate before you clean history theater.

1 · SEARCH

Org + history for .claude/settings*.json

History and forks keep deleted files

2 · ROTATE

Every secret the file ever held

Before cleanup theater

3 · REPO GITIGNORE

git rm --cached + project ignore

Global excludes stay on one laptop

4 · SCRUB LOCAL

Delete allow rules with secrets

Even if never pushed

5 · PATTERNS + ENV

Approve Bash(npm run:*) / $DATABASE_URL

Never literal passwords in the rule

At the prompt

If the command shows a secret, choose plain Yes (one-shot) or refuse and rewrite with an env var. Do not click don't-ask-again on that line.

In team policy

Require repo ignore for .claude/settings.local.json. Turn on host secret scanning. Treat agent allowlists like credential stores.

// Bottom Line

Agent permission UX is now a secrets surface. Don't-ask-again is convenient until it writes your production password into a project file that git ships to GitHub - Apiiro's 1,122 hits plus one confirmed live key make that concrete. Rotate, gitignore at the repo, and stop approving commands that embed secrets.

Enjoyed this?

New episodes Mon, Wed, Sat.