Claude Code settings files exposed secrets on GitHub: what to check and fix

Claude Code can save approved shell commands, including passwords, API tokens and keys, into .claude/settings.local.json. Researchers found thousands of these secrets in public GitHub repos and Docker Hub images. Here is what to check, fix and rotate.

TL;DR

Researchers found that Claude Code can save approved shell commands (including passwords, API tokens, and keys) into .claude/settings.local.json, which often ended up committed to GitHub. Thousands of secrets were exposed across many repos [2][4][5]. If your team uses Claude Code, search for these files, add repo-level .gitignore rules, and rotate any affected credentials now [2][5].

What happened

Apiiro’s research shows that when a developer approves a Claude Code command with “Yes, and don’t ask again,” the tool stores the exact command, including embedded secrets, in .claude/settings.local.json inside the project folder [2][4]. Anthropic’s approach adds this file to the developer’s global .gitignore, but that protection does not travel with the repository. If the repo is cloned elsewhere, or a folder later becomes a repo, the file can be committed [2][4]. In many cases, Claude Code itself modified or committed this settings file without the user realizing it [2][4].

Apiiro reports finding 104,185 publicly accessible copies of .claude/settings.local.json on GitHub. Of these, 1,122 contained real secrets, with 1,379 distinct secrets in total (636 provider-specific keys and 743 passwords or tokens) [2]. Another Apiiro count identified 2,539 credentials across nearly 2,000 public repos [2]. Ars Technica also cites over 100,000 such files, with about 1,100 containing secrets across 63 organizations [4]. A Ukrainian outlet similarly reports over 100,000 files and around 1,100 critical secrets, and notes that even after deletion, secrets may persist in forks [1].

GitGuardian’s independent review reportedly found over 31,000 unique secrets in .claude/settings.local.json across more than 23,000 repos, with over 5,000 still active when discovered. They also found 613 unique secrets in public Docker Hub images, 99 of them active at the time [5]. A Polish write-up adds that some credentials allowed potential access to medical records databases, and that at least one organization confirmed the exposed keys were still active when contacted [3].

Boris Cherny from the Claude Code team publicly said they are investigating mitigations, including making auto mode catch exposures or adding basic secrets scanning, to understand the tradeoffs before shipping a change [2]. Reports note earlier bug reports dating back to August 2025 that were closed after inactivity [1][5].

Who is affected

  • Organizations and individual developers who have used Claude Code and approved commands that included credentials (for example DB passwords, API tokens, cloud keys, SSH or root logins) [2][4].
  • Repositories where .claude/settings.local.json (or related agent files) may have been committed, whether public or later made public. Exposures persist in forks and history even after deletion [1][4][5].
  • Findings span 63 organizations “from student groups to startups, software agencies, and established vendors” [2].
  • GitGuardian also found such files and secrets in public Docker Hub images [5].

What is not published: the sources do not cite a vendor security advisory with a fixed version, or a confirmed shipping timeline for mitigations [2][5].

The risk in plain terms

  • If your team used Claude Code to run commands that included secrets, those credentials may have been written verbatim to a local settings file and accidentally committed to GitHub or included in container images [2][4][5].
  • Exposed data includes database passwords, cloud provider keys, API tokens, SSH and root logins, GitHub and GitLab tokens, and AWS keys [2][3][5]. Some credentials were reportedly still active at the time of discovery [3][5].
  • Secret scanners missed a material portion of these leaks (hundreds), because passwords embedded in command strings may not match known key formats [1][3][5].
  • Even if you delete the file from the main repo, copies may remain in forks and in repo history. GitHub recommends revoking or replacing any exposed credential rather than relying on deletion alone [5].

What to do now

  1. Pause persistent approvals for commands with credentials. Tell developers not to choose “Yes, and don’t ask again” for commands that include credentials until the vendor ships mitigations [2][4]. Per one write-up, this option is currently the default choice in the UI [3].
  2. Locate and remove committed agent files. Search your GitHub org for .claude/settings.local.json and remove it from tracking if present. Add the file to each repo’s own .gitignore (repo-level, not just global) so the rule travels with the project [2][3][4]. Treat AI agent folders as secret-bearing on laptops and in repos, and add them to pre-commit checks and secret scanning, including history [2].
  3. Rotate exposed and potentially exposed credentials. Rotate every credential a file has ever held, and delete rules or fields that contain secrets, even if you believe the file was never committed [2]. Follow GitHub’s recommendation: revoke or replace exposed tokens and passwords, and do not rely on file deletion to fix exposure in forks or history [5].
  4. Extend scanning beyond standard patterns. Popular tools such as Gitleaks and TruffleHog missed over 200 real secrets in these files, because passwords embedded in command strings look like plain text parameters [1][3][5]. Add manual review of .claude/settings.local.json and related agent files [2][3].
  5. Check other places your secrets may have landed. Review container images on public registries (for example Docker Hub) for .claude/settings.local.json. GitGuardian found active secrets there as well [5]. Per one report, secrets also appeared in agent memory files (such as memory.md) and chat transcripts, so inspect and sanitize these where they apply [3].
  6. Review commit history for agent involvement. In 539 of 1,105 repos with real secrets, a commit co-authored by Claude Code had modified the settings file [2]. Review commits where the agent was involved.
  7. Ask the vendor specific questions. Ask Anthropic when repo-level protections, auto-mode mitigations, or built-in secrets scanning will ship. Public comments indicate options are being evaluated but not yet shipped [2][5].

Quick checks for a single repo

Run these from the repository root. They show whether the file was ever committed, stop tracking it, and make the ignore rule part of the repo.

# Was the file ever committed, on any branch?
git log --all --oneline -- .claude/settings.local.json

# Stop tracking it (the file stays on disk)
git rm --cached .claude/settings.local.json

# Make the ignore rule travel with the repo
echo ".claude/settings.local.json" >> .gitignore

To search a whole GitHub organization, use code search with path:.claude/settings.local.json org:<your-org>. Removing the file from the latest commit does not remove it from history or forks, so rotate first and clean history second.

My take

The real problem is project-level hygiene. Relying on a developer’s global .gitignore is brittle. Make the repo carry its own protections, and rotate anything that ever touched these files [2][4]. The same applies to every coding agent that writes local state into the project folder: memory files, transcripts and permission lists all deserve the same treatment as a .env file.

Timeline

  • 2026-11-09 - Ars Technica reports Apiiro’s findings on Claude Code settings files exposing secrets [4].
  • 2026-11-10 - Coverage details counts, affected organizations and mitigation ideas, including the Dark Reading report and regional outlets [1][2][5].
  • 2026-11-18 - Additional analysis in Polish summarizes impacts and scanner gaps, and confirms at least one set of active keys [3].

Sources

  1. AI tool Claude Code leaks thousands of developer passwords and keys publicly on GitHub, 2026-11-10
  2. AI Coding Agents Leak Thousands of Secrets to Public GitHub Repositories, 2026-11-10
  3. Claude Code agent configs leaked over 1,300 secrets to public GitHub repos, including DB credentials and cloud keys, 2026-11-18
  4. Claude Code AI Tool Accidentally Exposes Sensitive Secrets on Public GitHub Repositories, 2026-11-09
  5. Passwords and API keys from Claude Code settings leaked in public GitHub repositories, 2026-11-10