---
title: "Claude Code's \"Don't Ask Again\" Saved Secrets in 1,122 Public GitHub Files - What to Do | Anomity Blog"
description: "Apiiro found 1,379 secrets in 1,122 public copies of Claude Code's .claude/settings.local.json, saved by \"Yes, and don't ask again\". How it happens and what to do."
url: "https://anomity.ai/blog/claude-code-dont-ask-again-settings-local-json-secrets/"
source: html
---

Claude Code's "Don't Ask Again" Saved Secrets in 1,122 Public GitHub Files - What to Do

Contents

- What to do now
- How a secret becomes a permission rule
- What the numbers show
- Why secret scanners miss many of these
- The laptop copy matters as much as the GitHub copy
- What Anthropic has said
- How Anomity surfaces and governs it
- Frequently asked questions

0%

8 min read

Share

- X.com

- LinkedIn

- Email

- Copy URL

- Copy markdown

[← Back to blog](https://anomity.ai/blog/)

- Home

- Blog

- Claude Code's "Don't Ask Again" Saved Secrets in 1,122 Public GitHub Files - What to Do

![Anomity robot illustrating Claude Code's "Don't Ask Again" Saved Secrets in 1,122 Public GitHub Files - What to Do]

Research

# Claude Code's "Don't Ask Again" Saved Secrets in 1,122 Public GitHub Files - What to Do

Anomity Research
Anomity Research
·
Nov 9, 2026
·
8 min read

Share: Copied

TL;DR

- On November 5, 2026 Apiiro researchers Shmulik Cohen and Matan Giladi showed that choosing "Yes, and don't ask again" on a Claude Code Bash prompt can save the exact command, secret included , as an allow rule in .claude/settings.local.json . When that file is committed, the password or token goes public with it.
- Of 104,185 public copies of the file on GitHub, 1,122 (about 1.1%) held at least one secret, 1,379 distinct values in all. More than a third open a database directly: 379 database passwords and 122 Supabase service-role keys , plus 43 SSH logins , 42 GitHub, GitLab and npm tokens and 23 AWS keys . Counting git history, the shared settings.json and agent transcripts, the total was 2,539 secrets in 1,994 repositories .
- Deleting the file does not fix it: 734 more secrets live only in earlier versions of the file, and 211 forks of 74 repositories carry the same values. Two common scanners together missed 215 of the 1,122 files, mostly passwords typed inside commands such as PGPASSWORD= or sshpass -p .
- Apiiro did not test any credential, so this is an exposure finding, not a confirmed breach ; one notified organization confirmed its key had been live. Anthropic's head of Claude Code said on November 7 the team is looking at fixes such as auto mode catching this and basic secret scanning .
- What to do: rotate first , then untrack the file, add it to each repository's own .gitignore , strip secret-bearing rules from local copies, and approve patterns rather than literal commands. For security teams, treat agent folders like .claude/ as secret-bearing on laptops , not only in repositories.

**The short version:** Claude Code's most convenient button can write a password to disk. Pick **"Yes, and don't ask again"** on a shell command that carries a credential and the saved allow rule can be the whole command, secret included, in **.claude/settings.local.json**. Research Apiiro published on **November 5, 2026** (updated November 8) counted **1,379 secrets in 1,122 public copies** of that file on GitHub, and **2,539** once history, shared settings and agent transcripts were added. Nothing here is a code-execution bug. It is a permission feature doing what it was built to do, in a file most security programs do not look at.

We have written about [how Claude Code permissions work](https://anomity.ai/blog/how-claude-code-permissions-work/) and [how to harden them](https://anomity.ai/blog/claude-code-permissions-hooks-hardening-guide/). This story sits at the point where those rules meet [secrets management for AI agents](https://anomity.ai/blog/secrets-management-for-ai-agents/): the allow list is meant to be policy, and in a meaningful share of real projects it has quietly become a credential store.

## What to do now

- Find every copy. Search your GitHub organization for .claude/settings.local.json and .claude/settings.json , and check each repository's history for them, including repositories where the file is gone today.
- Rotate first, clean up second. Any password, token or key a copy of the file has ever held should be treated as exposed. Removing the file does not reach git history, forks or existing clones.
- Untrack and ignore. Run git rm --cached .claude/settings.local.json where it is tracked and add it to the repository's own .gitignore , and to your organization's .gitignore templates, so the protection travels with the project.
- Clean local copies too. Open the file on developer machines, even where it was never committed, and delete every allow rule that contains a secret.
- Change the habit. Reference secrets as variables from a secrets manager, such as $DB_URL , so a saved rule holds a name rather than a value, and approve patterns like Bash(npm run *) instead of literal command lines.
- Widen secret scanning. Add agent folders such as .claude/ , .cursor/ , .gemini/ and .specstory/ to pre-commit and CI scanning, including history, and check that the scanner catches passwords inside commands, not only provider key formats.

## How a secret becomes a permission rule

Claude Code asks before it runs most shell commands. Its permissions documentation lists the options on that prompt, and for Bash the "don't ask again" choice is saved **permanently per repository and command**, as an allow rule in `.claude/settings.local.json` at the root of the git repository. A saved rule covers only what the prompt offered: sometimes a pattern, sometimes one exact command. For compound commands, Claude Code saves a separate rule for each part that needs approval, up to five per command.

The exact-command case is where secrets land. A developer asks the agent why a staging login fails, the agent proposes a `psql` call with the connection password inline, and after a long session of prompts the developer approves it permanently. Apiiro's write-up describes exactly this flow and notes it reproduced it with current models, which places the behavior in the Claude Code client rather than in any one model. The rule string is now the command, and the command contains the password.

Claude Code does try to keep the file private. Its settings documentation says that the first time it writes the file in a git repository that does not already ignore it, it adds `**/.claude/settings.local.json to the developer's**global**git excludes file, and that a file created by hand needs a .gitignore entry added manually. Apiiro's argument is about where that protection lives: in one user's git configuration on one computer. It does not cover a clone on another machine, a container, a folder that became a repository later, or a file that was already committed. Claude Code's own documentation notes that a tracked copy is treated as repository-supplied, so its allow rules wait for workspace trust; Apiiro adds that the user is not told the file is tracked, and new approvals keep being appended to it. Apiiro also found that in**539 of the 1,105** repositories it traced, a commit co-authored by Claude changed the file. ## What the numbers show Measure Apiiro finding Public copies of .claude/settings.local.json` 104,185 in 103,617 repositories

Copies holding a real secret 1,122 (about 1.1%), 1,379 distinct secrets

Split 636 provider keys, 743 passwords or tokens for public hosts

Database access 379 database passwords, 122 Supabase service-role keys

Other notable types 103 Supabase account tokens, 43 SSH logins, 42 GitHub/GitLab/npm tokens, 23 AWS keys, 6 private keys

Secrets only in file history 734, across 509 repositories

Forks carrying the same secrets 211 forks of 74 repositories

All sources combined 2,539 distinct secrets in 1,994 repositories

Two patterns stand out. First, **age**: every file with a secret was still on its repository's default branch on November 2, and in the median affected repository the file had first been committed 217 days earlier, more than a year earlier in 118 repositories. Second, **size**: about one in ten files over 8 KB held a secret, against fewer than one in 500 under 500 bytes. The longer a developer keeps approving commands permanently, the more the allow list accumulates.

Apiiro lists the strongest cases without naming owners: a database vendor's own cloud API key with manage access, a production Azure Postgres password, a Square production token, and the owner password of a medical-records application's database. Sixty-three organizations are affected, from student groups to software agencies and established vendors. The researchers say they reported each organization case on November 2 and 3, and one organization confirmed its key had been live.

## Why secret scanners miss many of these

Apiiro ran gitleaks and TruffleHog, without verification, over all 104,185 files. Of the 1,122 files with a real secret, gitleaks flagged 564 and TruffleHog 643, and **215 were flagged by neither**. The gap is passwords typed into commands. Scanners are tuned to key formats with a recognizable prefix or high-entropy string; a password after `PGPASSWORD=`, `sshpass -p` or `mysql -p`, or in a bearer header inside a `curl` call, reads as an ordinary word on an ordinary command line.

The same pattern shows up wherever an agent writes down what it ran. Apiiro found secrets in **298 of 76,011** shared `.claude/settings.json` files, which teams commit on purpose, in agent chat transcripts (120 files in 87 repositories, of 2,523 checked), in agent memory files, in handoff and deploy notes, and in VS Code Copilot auto-approve settings. Of 16 coding agents whose documentation it compared, Claude Code was the only one confirmed to write the full approved command to a project file by default, but the habit of typing a secret into an agent-run command is universal.

## The laptop copy matters as much as the GitHub copy

Most of these files never reach GitHub, and that does not make them safe. The allow list is plain JSON in a project folder, readable by anything that runs as the developer. Apiiro points to the **Shai-Hulud** npm worm, which in September 2025 ran TruffleHog over victims' files, and to the malicious Nx packages that told developers' own coding agents to search the disk for secrets. We have covered the [Shai-Hulud family](https://anomity.ai/blog/shai-hulud-2-npm-worm-credential-stealer/) and the growing market for [stolen AI and cloud keys](https://anomity.ai/blog/llmjacking-stolen-key-cost-abuse/); a permanent allow list full of connection strings is exactly the kind of file that tooling is built to harvest. The file can also leave without git, inside a published npm package, a Docker image built with a broad copy step, a zip archive or a synced folder.

This is the same lesson as Glow Labs' PixelLeak research, recorded in the Anomity vulnerability database as [coding agents posting internal screenshots to public repositories](https://anomity.ai/vulnerability-database/pixelleak-coding-agents-posted-13-000-internal-screenshots-to-public), and as [CVE-2026-46406](https://anomity.ai/vulnerability-database/cve-2026-46406), where Claude Code's `/copy` wrote responses to a world-readable temp path. Coding agents create files as a side effect of being helpful, and those files inherit whatever sensitive data passed through the session.

The remote version of this problem showed up days later. Cursor traced its October marketplace incident to credentials left unredacted in coding agent traces that were stored for model training and copied in the [Fireworks AI breach](https://anomity.ai/blog/fireworks-ai-breach-cursor-notion-agent-traces-credentials/).

## What Anthropic has said

Apiiro says it shared the research with Anthropic before publication. On **November 7**, Boris Cherny, who leads Claude Code, replied on Hacker News that Claude Code has not historically done secret scrubbing but that the team is looking into how to prevent this, and that it plans to prototype approaches including making sure **auto mode** catches it and building in **basic secret scanning** before shipping something. He also said the file is meant to stay local and is gitignored when Claude Code creates it, so in his view the exposed copies were created manually and checked in, recommended auto mode over hand-maintained permission rules, and recommended turning on the secret scanning that GitHub and other hosts provide. Apiiro notes that several earlier GitHub issues describing the same behavior, going back to August 2025, were closed without a reply.

Until a client-side fix ships, the control is on your side: find the files, rotate what they held, and make sure new approvals do not repeat the pattern. For fleets, that starts with knowing where Claude Code runs and which repositories carry local settings, which is the [audit we describe for Claude Code fleets](https://anomity.ai/blog/auditing-claude-code-across-a-fleet/).

## How Anomity surfaces and governs it

**See it.** The Anomity Endpoint Sensor discovers Claude Code and other coding agents on every managed machine, including user, shared project and project-local settings files such as `.claude/settings.local.json`, with the permission rules, hooks, MCP servers and skills each one declares. It flags plaintext secrets it recognizes in agent configs, MCP server definitions and memory files, reporting the pattern, file and field, never the value: secrets are redacted on the endpoint and only metadata leaves. That turns "which repositories on which laptops hold credentials in an agent allow list" into a query rather than a survey, including the copies that never reached GitHub.

**Enforce before the call runs.** On agents that expose a pre-execution hook, such as Claude Code **PreToolUse**, Anomity can **allow, deny or log** a shell call before it runs, so a policy can stop or record commands that carry credentials instead of relying on someone reading a long command line on the tenth prompt of the day. **Keep the record.** Configuration changes and decisions land in a **90-day audit trail** and route to **SIEM, Slack, email or Jira**. Anomity is SOC 2 Type II and complements secret scanning, EDR, DLP and GRC tooling; it does not replace them. To see which agent settings files on your fleet hold secrets today, [book a 30-minute demo](https://anomity.ai/#early-access).

Share: Copied

## Frequently asked questions

What did Apiiro find in Claude Code's settings.local.json?
Apiiro searched public GitHub between November 1 and 3, 2026 and downloaded 104,185 copies of .claude/settings.local.json from 103,617 repositories. 1,122 of them, about 1.1%, held what it classed as a real secret: a key in a known provider format, or a password or token next to a public host. Those files held 1,379 distinct secrets. Including older versions of the file, the shared .claude/settings.json, agent chat transcripts and similar files, the count reached 2,539 distinct secrets across 1,994 repositories, belonging mostly to individual developers but also to 63 organizations.

How does a secret end up in the file?
Claude Code asks before it runs most shell commands. When a developer picks "Yes, and don't ask again" for a Bash command, Claude Code's documentation says the approval is saved permanently per repository and command, as an allow rule in .claude/settings.local.json at the root of the git repository. If the prompt offered the exact command rather than a pattern, the saved rule is that command string. When the command carried a password, token or connection string, for example a psql call with PGPASSWORD set inline, the secret is now stored in plain text in the project folder.

Doesn't Claude Code keep that file out of git?
It tries. The settings documentation says that the first time Claude Code writes the file in a git repository that does not already ignore it, it adds **/.claude/settings.local.json to the developer's global git excludes file. Apiiro's point is that this protection lives in one user's git configuration on one machine. It does not travel with the repository, does not help on a second machine, in a container or in a folder that becomes a repository later, does not cover a file created by hand, and does nothing for a file that was already committed. In 539 of the 1,105 repositories Apiiro traced, a commit co-authored by Claude had changed the file.

Are these secrets confirmed to be live or abused?
No. Apiiro says it did not use or test any credential and contacted no host, so the figures describe exposure, not compromise. It classified values with pattern rules, false-positive filters and an independent LLM review of masked candidates. It notified affected organizations on November 2 and 3, 2026, and one of them confirmed that its exposed key had been live. Treat any credential that ever sat in one of these files as exposed until rotated.

What has Anthropic said?
Boris Cherny, who leads Claude Code at Anthropic, replied on Hacker News on November 7, 2026. He said Claude Code has not historically done secret scrubbing but the team is looking into how to prevent this, and named approaches it plans to prototype, including making sure auto mode catches it and building in basic secret scanning. He also said the file is meant to stay local and is gitignored when Claude Code creates it, recommended auto mode over hand-maintained permission rules, and recommended enabling the secret scanning that GitHub and other hosts offer.

Is this only a Claude Code problem?
The mechanism is specific: of 16 coding agents whose documentation Apiiro compared, Claude Code was the only one confirmed to write the full approved command to a project file by default. The habit behind it is not. Apiiro also found secrets in agent chat transcripts, agent memory files, handoff notes and VS Code Copilot auto-approve settings. Anywhere an agent records what it ran, a secret typed into a command can be recorded with it.

How does Anomity help with this?
The Anomity Endpoint Sensor discovers Claude Code configuration on every managed machine, including project-local .claude/settings.local.json files and their permission rules, and flags plaintext secrets it recognizes in agent configs, MCP server definitions and memory files. It reports the pattern, file and field, never the value, because secrets are redacted on the endpoint. On Claude Code's PreToolUse hook, Anomity can allow, deny or log a shell call before it runs, so a policy can stop or record commands that carry credentials. Findings route to SIEM, Slack, email or Jira and land in a 90-day audit trail. Anomity complements secret scanning, EDR and DLP; it does not replace them.

## Related posts

[Research ### How Claude Code Auto Mode Decides What to Block - and What Security Teams Should Set How Claude Code auto mode's classifier allows or blocks actions, the 17% miss rate Anthropic reports, and the settings, hooks and inventory security teams need. Anomity Research · Nov 13, 2026 · 10 min](https://anomity.ai/blog/claude-code-auto-mode-classifier-governance/)

[Advisory Critical ### GitSpawn - Malicious .git Configs Make Coding Agents Run Attacker Code Manifold's GitSpawn (Sep 1 2026): malicious .git/config core.fsmonitor runs on git status/diff during agent context gather - outside sandbox, no approval. Patched in goose, Codex, Cursor, Claude Code; several agents still open. Anomity Research · Sep 14, 2026 · GitSpawn (Manifold, 2026-09-01); CVE-2026-72718 (goose), CVE-2026-19592 (Codex CLI), CVE-2026-71963 (Hermes)](https://anomity.ai/blog/gitspawn-malicious-git-config-coding-agent-rce/)

[Research ### The Fireworks AI Breach - How Stored Agent Traces Led to Cursor's Malicious Claude Code Extension Cursor traced its malicious Claude Code extension to a key exposed in the Fireworks AI breach, which also hit Notion and Uber. What happened and what to change. Anomity Research · Nov 16, 2026 · 8 min](https://anomity.ai/blog/fireworks-ai-breach-cursor-notion-agent-traces-credentials/)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "headline": "Claude Code's \"Don't Ask Again\" Saved Secrets in 1,122 Public GitHub Files - What to Do",
  "description": "Apiiro found 1,379 secrets in 1,122 public copies of Claude Code's .claude/settings.local.json, saved by \"Yes, and don't ask again\". How it happens and what to do.",
  "datePublished": "2026-11-09",
  "dateModified": "2026-11-09",
  "author": {
    "@type": "Person",
    "name": "Anomity Research",
    "jobTitle": "Anomity Research"
  },
  "publisher": {
    "@type": "Organization",
    "name": "Anomity",
    "url": "https://anomity.ai/",
    "sameAs": [
      "https://www.linkedin.com/company/anomity",
      "https://github.com/Anomity-ai",
      "https://www.wikidata.org/wiki/Q140763940"
    ],
    "logo": {
      "@type": "ImageObject",
      "url": "https://anomity.ai/anomity-logo.png"
    }
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://anomity.ai/blog/claude-code-dont-ask-again-settings-local-json-secrets/",
    "relatedLink": [
      "https://anomity.ai/blog/claude-code-auto-mode-classifier-governance/",
      "https://anomity.ai/blog/gitspawn-malicious-git-config-coding-agent-rce/",
      "https://anomity.ai/blog/fireworks-ai-breach-cursor-notion-agent-traces-credentials/"
    ]
  },
  "image": {
    "@type": "ImageObject",
    "url": "https://anomity.ai/assets/blog/covers/coding-agents.jpg",
    "width": 1200,
    "height": 630
  },
  "articleSection": "Research",
  "wordCount": 1669,
  "timeRequired": "PT8M",
  "inLanguage": "en",
  "url": "https://anomity.ai/blog/claude-code-dont-ask-again-settings-local-json-secrets/",
  "keywords": "Claude Code settings.local.json secrets, Claude Code, settings.local.json, Secrets Exposure, Permission Rules, Coding Agents, Secret Scanning, Credential Rotation, agentic AI security"
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What did Apiiro find in Claude Code's settings.local.json?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Apiiro searched public GitHub between November 1 and 3, 2026 and downloaded 104,185 copies of .claude/settings.local.json from 103,617 repositories. 1,122 of them, about 1.1%, held what it classed as a real secret: a key in a known provider format, or a password or token next to a public host. Those files held 1,379 distinct secrets. Including older versions of the file, the shared .claude/settings.json, agent chat transcripts and similar files, the count reached 2,539 distinct secrets across 1,994 repositories, belonging mostly to individual developers but also to 63 organizations."
      }
    },
    {
      "@type": "Question",
      "name": "How does a secret end up in the file?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Claude Code asks before it runs most shell commands. When a developer picks \"Yes, and don't ask again\" for a Bash command, Claude Code's documentation says the approval is saved permanently per repository and command, as an allow rule in .claude/settings.local.json at the root of the git repository. If the prompt offered the exact command rather than a pattern, the saved rule is that command string. When the command carried a password, token or connection string, for example a psql call with PGPASSWORD set inline, the secret is now stored in plain text in the project folder."
      }
    },
    {
      "@type": "Question",
      "name": "Doesn't Claude Code keep that file out of git?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "It tries. The settings documentation says that the first time Claude Code writes the file in a git repository that does not already ignore it, it adds **/.claude/settings.local.json to the developer's global git excludes file. Apiiro's point is that this protection lives in one user's git configuration on one machine. It does not travel with the repository, does not help on a second machine, in a container or in a folder that becomes a repository later, does not cover a file created by hand, and does nothing for a file that was already committed. In 539 of the 1,105 repositories Apiiro traced, a commit co-authored by Claude had changed the file."
      }
    },
    {
      "@type": "Question",
      "name": "Are these secrets confirmed to be live or abused?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No. Apiiro says it did not use or test any credential and contacted no host, so the figures describe exposure, not compromise. It classified values with pattern rules, false-positive filters and an independent LLM review of masked candidates. It notified affected organizations on November 2 and 3, 2026, and one of them confirmed that its exposed key had been live. Treat any credential that ever sat in one of these files as exposed until rotated."
      }
    },
    {
      "@type": "Question",
      "name": "What has Anthropic said?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Boris Cherny, who leads Claude Code at Anthropic, replied on Hacker News on November 7, 2026. He said Claude Code has not historically done secret scrubbing but the team is looking into how to prevent this, and named approaches it plans to prototype, including making sure auto mode catches it and building in basic secret scanning. He also said the file is meant to stay local and is gitignored when Claude Code creates it, recommended auto mode over hand-maintained permission rules, and recommended enabling the secret scanning that GitHub and other hosts offer."
      }
    },
    {
      "@type": "Question",
      "name": "Is this only a Claude Code problem?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The mechanism is specific: of 16 coding agents whose documentation Apiiro compared, Claude Code was the only one confirmed to write the full approved command to a project file by default. The habit behind it is not. Apiiro also found secrets in agent chat transcripts, agent memory files, handoff notes and VS Code Copilot auto-approve settings. Anywhere an agent records what it ran, a secret typed into a command can be recorded with it."
      }
    },
    {
      "@type": "Question",
      "name": "How does Anomity help with this?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The Anomity Endpoint Sensor discovers Claude Code configuration on every managed machine, including project-local .claude/settings.local.json files and their permission rules, and flags plaintext secrets it recognizes in agent configs, MCP server definitions and memory files. It reports the pattern, file and field, never the value, because secrets are redacted on the endpoint. On Claude Code's PreToolUse hook, Anomity can allow, deny or log a shell call before it runs, so a policy can stop or record commands that carry credentials. Findings route to SIEM, Slack, email or Jira and land in a 90-day audit trail. Anomity complements secret scanning, EDR and DLP; it does not replace them."
      }
    }
  ]
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://anomity.ai/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://anomity.ai/blog/"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Claude Code's \"Don't Ask Again\" Saved Secrets in 1,122 Public GitHub Files - What to Do",
      "item": "https://anomity.ai/blog/claude-code-dont-ask-again-settings-local-json-secrets/"
    }
  ]
}
```
