Claude Code's 'Don't Ask Again' Leaked 31,000 Secrets on GitHub
A GitGuardian scan of 17 months of public code found tens of thousands of real credentials sitting in a file Claude Code's 'Yes, and don't ask again' button creates.

GitGuardian's security researchers scanned 17 months of public GitHub and Docker Hub history and found 31,088 distinct secrets sitting inside .claude/settings.local.json, a file Anthropic's Claude Code coding assistant creates the moment a developer clicks "Yes, and don't ask again" on a permission prompt. The file turned up in 23,276 public repositories, and 5,343 of the secrets it held were still live and usable when GitGuardian checked them on November 7, 2026. The research, published November 9 on GitGuardian's blog, also found copies baked into 543 public Docker Hub image repositories, where deleting the file from GitHub does nothing to scrub it from an image that already shipped.
- Claude Code's "Yes, and don't ask again" option saves the approved command, including any password or API key typed inside it, into a local project file called
.claude/settings.local.json. - GitGuardian found 31,088 distinct secrets in that file across 23,276 public GitHub repositories, with 5,343 still valid as of November 7, 2026.
- A separate, smaller analysis by security firm Apiiro, published November 5, had already flagged real secrets in more than a thousand public copies of the same file.
- Monthly leaks peaked at 12,535 in April 2026 and had fallen 92% by October, though GitGuardian says the cause of the drop is unconfirmed.
- Anthropic's Claude Code lead, Boris Cherny, has acknowledged the issue and pointed to upcoming secret-scanning and "auto mode" safeguards, but no fix has shipped yet.
What GitGuardian actually found
GitGuardian, a code-security company whose products scan source code for exposed credentials, publishes recurring research into where secrets leak in public code. Its latest report focuses specifically on files created by Claude Code, Anthropic's command-line coding agent. Scanning public GitHub activity from January 2025 through November 7, 2026, GitGuardian counted 71,525 total occurrences of secrets inside .claude/settings.local.json files — 31,088 of them distinct credentials — spread across 23,276 repositories and 11,336 different commit authors. Of the occurrences GitGuardian could verify, 67% were still active, working credentials rather than expired test keys.
A companion file, the team-shared .claude/settings.json, added another 17,705 occurrences and 8,271 distinct secrets across 6,839 repositories, with 57% of verified entries still valid. GitGuardian also checked other Claude Code and competing-agent files: CLAUDE.md held 6,155 distinct secrets, and separate credential-cache files used by Codex and other agents added thousands more.
How "don't ask again" creates the file
Claude Code asks permission before running most shell commands. According to Anthropic's own permissions documentation, a Bash command prompt offers a "Yes, and don't ask again" option, and choosing it saves a permanent allow rule for that exact command in that repository. Anthropic's settings documentation confirms where that rule lives: "When Claude asks permission to run a Bash command and you choose 'Yes, and don't ask again,' Claude Code saves that approval as an allow rule" in .claude/settings.local.json, a file scoped to "you, in this one project only."
The trouble is what counts as "the command." If a developer approves a curl request that includes an API key in its header, or a database connection string passed as an argument, Claude Code stores that full string, credentials included, as the saved rule. GitGuardian's breakdown backs this up: curl commands account for roughly half of all occurrences, and database and SSH credentials are among the categories most likely to still be valid when found.
Anthropic's documentation says Claude Code tries to protect the file: the first time it writes .claude/settings.local.json inside a git repository, it adds the path to the user's global git-ignore list, so the file "stays out of your commits in every repository" by default. That protection has two gaps GitGuardian's data exposes. First, it only applies automatically to files Claude Code itself creates — a file a developer creates by hand, copies between machines, or that a teammate commits before realizing what it contains isn't covered unless someone adds it to .gitignore manually. Second, .gitignore has no effect on Docker builds: a COPY . . instruction in a Dockerfile copies the whole project directory, including ignored files, straight into an image that then gets pushed to a public registry.
Secrets baked into Docker Hub images
That second gap shows up directly in GitGuardian's Docker Hub numbers. The company found 109,284 occurrences of secrets from settings.local.json and another 29,613 from settings.json inside public container images, spanning 543 image repositories and 7,625 tags. Of the 613 distinct secrets involved, 99 were still valid. GitGuardian traced 72% of the exposed files to images that copy an entire project directory into paths like /app, /workspace, or /usr/src — exactly the pattern a basic COPY . . Dockerfile line produces. In one case, a valid Cloudflare API token appeared in 559 different tags of a single image; in another, a database password turned up across 643 tags spanning seven separate image repositories. Because registries retain old tags indefinitely, removing the credential from the source repository does not remove it from images already pulled by anyone who downloaded them.
| Secret category | Valid, distinct secrets found | Examples GitGuardian cites |
|---|---|---|
| Database credentials | 2,280 | 1,955 Postgres connection strings, 116 MongoDB URIs |
| Cloud provider tokens | 971 | 941 Google API keys |
| AI service tokens | 583 | 186 DeepSeek keys, 142 Resend keys, 139 Anthropic keys (28 valid) |
| Messaging / SSH | 647 | 355 Telegram bot tokens, 292 SSH passwords |
Who the leaked credentials belong to
GitGuardian also broke the exposure down by the type of account doing the committing. Secrets tied to personal email domains made up the largest group, at 15,993 distinct secrets, 4,270 of them valid. Corporate or custom domains accounted for 5,924 distinct secrets across 3,338 separate organizations, 1,499 of them still working. Among the 417 organizations GitGuardian could match, education and research institutions led with 172 affected organizations, followed by software and IT services companies with 141. In 263 repositories, the commit that introduced the leak used Claude's own git-noreply address as the author — a sign the exposure happened during an unattended or lightly supervised agent session rather than a careful manual commit.
A second research firm flagged the same pattern days earlier
GitGuardian's report wasn't the first to notice. Security firm Apiiro published its own, narrower analysis on November 5, 2026, counting real secrets in the current, live version of public settings.local.json files plus whatever remained in each repository's git history — a smaller scope than GitGuardian's full-history scan, which is why its headline numbers come in lower. The two firms arrived at the same underlying finding independently and within days of each other: a convenience feature built into one of the most widely used AI coding agents was routinely capturing and publishing credentials that were never meant to leave a developer's machine.
What Anthropic has said
Claude Code's engineering lead, Boris Cherny, responded publicly after the reports circulated, acknowledging that the tool "has not done secret scrubbing" historically, "but we are looking into what we can do to prevent this." He pointed developers toward Claude Code's newer "auto mode" as a safer alternative to broad permission rules, alongside standard host- and GitHub-level secret scanning, and said built-in secret detection is being explored but is not confirmed as a finished fix. Anthropic's own documentation already recommends treating the .claude directory as something to actively manage: it tells teams to commit the shared .claude/settings.json deliberately while keeping personal overrides in the local file, and to add that local file to .gitignore by hand if it was ever created outside of Claude Code itself.
For context on how Claude Code's permission tiers work day to day — including which actions need a yes/no prompt and which don't — Anthropic's permissions documentation and the Claude Code repository on GitHub are the primary references developers are being pointed to while a product-level fix is worked out.
A leak that is shrinking, for reasons nobody has confirmed
One genuinely good-news thread in the data: monthly leaks of settings.local.json secrets rose steadily from 256 occurrences in June 2025 to a peak of 12,535 in April 2026, then fell sharply — to 5,276 in June, 1,916 in August, and just 959 by October 2026, a 92% drop from the peak. The shared settings.json file shows the same rise-then-fall pattern, peaking in May 2026 and dropping 84% by October, trailing the other file's decline by about a month. GitGuardian's own report is explicit that it doesn't know why: the decline could reflect developers getting more careful, Anthropic making quiet product changes, GitHub's own secret scanning catching more leaks before they're indexed, or some combination the data can't distinguish. Whatever the cause, the absolute numbers recorded this year, more than 30,000 distinct credentials and over 71,000 total occurrences, happened on Claude Code's watch, and the file keeps getting created by design every time a developer answers a permission prompt the easy way.
How to check whether your own repos are affected
GitGuardian's recommendations, aimed at developers who use Claude Code or any similar coding agent, boil down to five steps:
- Treat agent config files as secret-bearing. That means
.claude/,.claude/settings.local.json,CLAUDE.md, and the equivalent files for other agents such as.cursor/,.gemini/, and.codex/— scan them the same way you'd scan a.envfile, in pre-commit hooks, CI, and container builds. - Check git history, not just the current file. Deleting a committed secret from the latest commit does not remove it from history or from any Docker image already pushed; the credential has to be rotated, not just hidden.
- Add the file to both
.gitignoreand.dockerignore. Claude Code handles the git side automatically once it creates the file, but Docker builds need an explicit.dockerignoreentry, sinceCOPYdoes not respect.gitignore. - Rotate anything that was ever exposed. If a secret ever appeared in a public commit or pushed image, treat it as compromised regardless of whether misuse has been detected.
- Reference secrets as variables instead of literal values in any command you're about to approve, and prefer narrow permission rules (a specific command) over broad wildcard rules like allowing every
curlinvocation.
Anthropic's settings documentation adds one more specific fix: if you created .claude/settings.local.json by hand rather than letting Claude Code write it, the automatic git-ignore protection never kicked in, so add it to your project's .gitignore yourself. Developers who use Anthropic's other Claude-branded tools day to day are not directly affected by this specific file, since the leak is tied to Claude Code's terminal and IDE integrations rather than the chat product, but the same "don't ask again" instinct is worth being cautious about in any AI tool that can execute commands on your behalf.
Why this matters beyond one file format
The underlying problem is not unique to Anthropic. Every AI coding agent that can run shell commands has to decide how much friction to put between a developer and repeated approval prompts, and every one of those "remember this choice" features creates a record somewhere. What makes this case notable is scale and persistence: a single convenience click, repeated across tens of thousands of independent projects over 17 months, produced a public, searchable, and in two-thirds of cases still-valid inventory of credentials — the kind of dataset that previously required a targeted breach to assemble. It's a useful case study for any team evaluating AI tools built for security-sensitive workflows: the risk isn't necessarily that the AI model misbehaves, but that the plumbing around it — a settings file, a cache, a log — behaves exactly as documented and still leaks.
What happens next
No regulatory body has gotten involved, and this isn't a tracked CVE — it's a configuration and workflow issue rather than a software vulnerability in the traditional sense, so there's no patch to install. The near-term fix is entirely on individual developers and teams: audit your own repositories and Docker images for .claude/settings.local.json, rotate anything you find, and tighten how permission rules get approved going forward. Longer term, watch for Anthropic to formalize the "auto mode" and secret-scanning safeguards Cherny referenced; neither has a committed ship date as of this report. GitGuardian says it will keep tracking the monthly trend, so whether the sharp decline since April holds up — or reverses as Claude Code's user base keeps growing — should become clearer over the next few monthly cycles.
Frequently asked questions
What is Claude Code's "Don't Ask Again" feature?
It's a permission-prompt option in Anthropic's Claude Code coding agent. When Claude asks to run a shell command and you choose "Yes, and don't ask again," Claude Code saves that exact command as a standing allow rule in a project file called .claude/settings.local.json so it won't ask again for the same command.
How many secrets did GitGuardian actually find?
GitGuardian counted 31,088 distinct secrets inside public .claude/settings.local.json files across 23,276 GitHub repositories, with 71,525 total occurrences when counting every time a secret appeared. Of those it could verify, 5,343 were still valid, working credentials as of November 7, 2026.
Why does approving a command leak a secret?
If the command a developer approves contains a credential, such as a curl request with an API key in the header or a database connection string passed as an argument, Claude Code stores that full string as the saved rule. If the project is later pushed to a public GitHub repository or baked into a Docker image, the credential goes with it.
Has Anthropic fixed this?
Not yet. Claude Code lead Boris Cherny acknowledged the tool has not historically scrubbed secrets and said the team is exploring fixes, including built-in secret scanning and steering developers toward Claude Code's newer "auto mode." As of this report, no shipped fix has been confirmed.
How do I check if my own repository is affected?
Look for a .claude/settings.local.json file in your project's git history and in any Docker images you've pushed, since .gitignore doesn't protect against a Dockerfile's COPY . . instruction. If you find credentials in it, rotate them immediately rather than just deleting the file, since old commits and image tags can still hold the original copy.
Does this affect ChatGPT, Gemini, or other AI assistants too?
This specific file is unique to Claude Code's permission system, but GitGuardian's report notes similar config and credential-cache files exist for other coding agents, including Cursor, Gemini CLI, and Codex, and recommends treating all of them as secret-bearing files that need the same scanning and gitignore treatment.
Sources
- GitGuardian: Claude Code settings.local.json Secrets — 17 months of exposure on GitHub & Docker Hubblog.gitguardian.com
- Anthropic Claude Code docs: Settings files and precedencecode.claude.com
- Anthropic Claude Code docs: Configure permissionscode.claude.com
- Claude Code repository, GitHub (anthropics/claude-code)github.com
- Claude Code product page, Anthropicclaude.com
Theo Park runs the AI desk at Pandromeda. He follows model launches from the frontier labs and the open-weight community, tracks the assistants and developer tools built on them, and explains what each release changes on pricing, capability and safety. His reporting leans on primary sources: model cards, technical reports, API documentation and the companies' own announcements.


