Claude Code Security
Claude Code's 'Don't Ask Again' Exposed 2,539 Secrets on GitHub
Security firm Apiiro found that Claude Code's "don't ask again" feature stores passwords, API keys, and SSH logins in plain text in a local settings file — and over 1,000 copies ended up in public GitHub repositories. Anthropic's Claude Code lead acknowledged the issue but existing fixes may not fully solve it.
The 'Don't Ask Again' Trap
When Claude Code asks permission before running a shell command and the developer clicks "Yes, and don't ask again," the tool saves an allow rule to .claude/settings.local.json in the project folder. If the command contains a secret — a password, an API key, an SSH login — that secret gets written into the JSON file in plain text. Security firm Apiiro published the findings on November 8 after scanning public GitHub for exposed copies of this file.
The results were stark: 104,185 copies of the settings file across 103,617 repositories. Of those, 1,122 files held at least one real secret — 1,379 distinct secrets total. When Apiiro included older file versions, shared settings, and chat transcripts, the count rose to 2,539 secrets across 1,994 repositories.
What Got Exposed
The exposed secrets paint a picture of production credentials left in public view. Anthropic's head of Claude Code, Boris Cherny, addressed the issue on:1 Apiiro found 379 database passwords, 122 Supabase service‑role keys, 43 SSH logins (some with root access), 42 GitHub, GitLab, and npm tokens, and 23 AWS keys. As Apiiro detailed in its report, the haul included a database vendor's own cloud API key with management access, a software agency's production Square token, and the owner password for a medical‑records app's cloud database.
"More than one third opened a database directly," Apiiro noted. The firm did not test whether the credentials were still active, but one notified organization confirmed its key was live. Most affected files belonged to individual developers, but 63 organizations were also impacted, from student groups to established vendors.
"Historically Claude Code has not done secret scrubbing (there are many good tools for that), but we are looking into what we can do to prevent this."
Not Just User Error — Claude Commits the File Too
Anthropic's Boris Cherny pointed out on 1 that Claude Code gitignores the settings file on creation, suggesting the exposed copies were manually created and checked in. But Apiiro's data tells a more complicated story: in 539 of the 1,105 repositories with a real secret that Apiiro traced, a commit co‑authored by Claude changed the file, as Apiiro found. As one Apiiro researcher noted on,1 "Often Claude commits the file itself."
This means the agent that created the problem is sometimes also the agent that committed the evidence to GitHub. Developers who rely on Claude Code's gitignore as a safety net should not assume it will catch every exposure — especially when Claude itself is making commits as part of a coding workflow.
- Use env vars Reference secrets as
$TOKENor environment variables instead of typing them into commands - Approve patterns When Claude asks permission, approve a pattern rather than a literal command to avoid storing exact secrets
- Global gitignore Add
.claude/to your machine‑wide global gitignore, not just per‑repo - Rotate everything Rotate every credential that was ever stored in the file — deleting it doesn't clean git history, forks, or clones
Secret Scanners Missed 215 Exposed Files
Conventional secret‑scanning tools offered patchy protection. Of the 1,122 files with a secret, gitleaks flagged 564 and TruffleHog flagged 643, but 215 files slipped past both tools. This gap means developers who rely on standard CI/CD scanning may have a false sense of security about their Claude Code settings files.
The risk extends beyond public GitHub. Malware has already hunted for these files: the Shai‑Hulud npm worm ran TruffleHog over victims' files in September 2025, as iTnews reported. In April 2026, Check Point‑owned Lakera found credentials in 33 such files across 30 npm packages, showing the exposure vector has been known — and exploitable — for months.
What Anthropic Is Doing (and What It Can't Fix)
Anthropic is exploring several mitigations,:1 prototyping an auto mode to catch commands with embedded secrets, and building basic secret scanning into Claude Code. Cherny acknowledged on 1 that these may not fully solve the problem. When a reader pointed out the same exposure could occur in auto mode, Cherny wrote on:1 "Yeah good catch."
The core issue is architectural: Claude Code stores approved commands as literal strings in a project file. Any fix that doesn't change this — by, for example, hashing commands or storing only wildcard patterns — will leave a residual risk. For now, the safest approach is to never type secrets into Claude Code commands. Use environment variables, approve patterns not literal commands, and ensure .claude/ is in your global gitignore. And rotate any credentials that ever touched a settings.local.json file.
Sources
- 1.Hacker News(news.ycombinator.com)
- 2.iTnews(itnews.com.au)
Related News
Nov 9, 2026
Anthropic Pays $3.4 Billion for 1.7GW of Gas Generators to Power AI Data Centers
Anthropic has spent $3.4 billion to take over a queue position for 1.7 gigawatts of Caterpillar gas generators originally ordered by OnePWR Solutions. It is the largest known single purchase of power-generation equipment by an AI lab, as demand outruns factory capacity for new generator orders.
Nov 9, 2026
OpenAI, Google, Microsoft, and Anthropic Back Unified AI Training Opt-Out in Robots.txt
The four largest Western AI labs will honor a single robots.txt policy token that lets website owners opt out of AI training across all their crawlers at once. Anthropic has already begun implementation; OpenAI, Google, and Microsoft follow in 2027.
Nov 9, 2026
OpenAI Acquires Pierre to Build End-to-End Dev Platform in Codex
OpenAI is acquiring Pierre Computer Company, maker of Code Storage and open-source Git tools Trees and Diffs, to transform Codex from an AI coding assistant into a full-spectrum development platform. The deal brings Pierre's source control, code review, and project organization tools into Codex, building on OpenAI's recently launched Pando Git backend.