Claude Code Permission Files Leak 31,088 GitHub Secrets abstract technical diagram

Updated on November 23, 2026

Security audits from Apiiro and GitGuardian have exposed a systemic credential leak vector inside Claude Code’s command-approval workflow. When a developer clicks “Yes, and don’t ask again” on a proposed shell command containing an inline token or database password, Claude Code persists the full literal command string as a permanent allow rule inside .claude/settings.local.json in the active workspace.

Across public GitHub pushes recorded between January 2025 and November 7, 2026, GitGuardian counted 71,525 secret occurrences representing 31,088 distinct credentials inside .claude/settings.local.json across 23,276 repositories and 11,336 authors. Automated read-only validity checks confirmed that 5,343 of those distinct secrets were still active at the moment of detection. Another 8,271 distinct secrets surfaced in shared .claude/settings.json files across 6,839 repositories, with 1,283 confirmed live.

The root cause sits in an assumption about git ignore rules. When Claude Code creates .claude/settings.local.json inside an initialized git directory, it adds an entry to the developer’s machine-local ignore configuration rather than modifying the repository’s tracked .gitignore. That local exclusion fails whenever a folder is initialized as a git repository later, when a colleague clones or copies the directory, when an agent runs git add across untracked files, or when a container build executes COPY . . without a matching .dockerignore entry.

Conventional secret scanners also missed a large share of the exposure. Because developers pass passwords via shell variable prefixes such as PGPASSWORD=, DATABASE_URL=, and raw curl headers, generic key-format detectors overlook credentials that lack a vendor prefix. Apiiro reported that gitleaks and TruffleHog together missed roughly one in five leaking files, while GitGuardian noted that generic password and bearer-token detectors accounted for 63% of all occurrences (44,755 of 71,525).

Fast Facts
  • GitHub Exposure Scale: In its continuous commit-monitoring audit, GitGuardian’s technical analysis documented 31,088 distinct secrets (71,525 total occurrences) in .claude/settings.local.json across 23,276 public repositories, with 5,343 distinct secrets (17% overall, and 67% of checkable occurrences) still valid at detection.
  • Apiiro Discovery and Organizational Scope: Research by Apiiro, summarized by InfoQ, scanned active default branches plus git history across 43,120 repositories and 211 forks, locating 1,122 active secrets in .claude/settings.local.json and 1,160 more across git history, shared settings.json, and stored agent chat transcripts affecting 63 organizations.
  • Highest-Validity Credential Classes: GitGuardian found database identifiers formed the largest live bucket at 2,280 distinct valid secrets, including 1,955 valid Postgres connection strings (5,076 live occurrences) and 116 valid MongoDB URIs, followed by 971 valid cloud tokens, 941 valid Google API keys, 583 valid AI provider tokens (186 DeepSeek keys), 355 Telegram bot tokens, 292 SSH passwords, and 142 Resend keys.
  • Docker Hub Container Spillover: Public Docker Hub images held 109,284 secret occurrences in .claude/settings.local.json and 29,613 in .claude/settings.json across 543 image repositories and 7,625 tags (613 distinct secrets, 99 valid). Roughly 72% sat under /app, /workspace, or /usr/src after naive COPY . . builds bypassed git exclusions.
  • Peak vs. Recent Trend: GitGuardian observed settings.local.json leaks climbing past 3,000 monthly occurrences before peaking and dropping 92% by October 2026 (5,276 occurrences in June, 1,916 in August, and 959 in October), though single exposed tokens persisted across hundreds of immutable container tags.

Why Allow Rules Turn Routine Shell Commands Into Credential Vaults

Every team running terminal-capable coding agents faces the same architectural friction: engineers want fast autonomous iteration without clicking approve on twenty identical curl or psql invocations. When a CLI agent serializes the literal approved command into a predictable workspace path, it turns convenience memory into a plaintext credential catalog located at the exact same relative path in every project.

Approved Command Pattern Share of Leaked Rules Typical Exposed Material Valid Share (Where Checkable)
curl Requests 50% Bearer tokens, JWTs, -u user:pass, API headers Low
Inline Env Prefixes (PGPASSWORD=, DATABASE_URL=) 15% Postgres passwords, database URIs, Supabase tokens 29%
export Statements 5% Service-role keys, API keys, JWTs 18%
Database CLIs (psql, mysql, mongosh, redis-cli) 4% Connection strings and inline -p passwords 50% and above
Script One-Liners (node, python, npx) 3% Keys passed as positional CLI arguments 20%
SSH Tools (sshpass -p, ssh user:pass@) 1% Server and root login passwords 54%
Tool Rules (WebFetch, Read) 1% Embedded URL credentials and token paths Low
curl Requests
Share of Leaked Rules50%
Typical Exposed MaterialBearer tokens, JWTs, -u user:pass, API headers
Valid Share (Where Checkable)Low
Inline Env Prefixes (PGPASSWORD=, DATABASE_URL=)
Share of Leaked Rules15%
Typical Exposed MaterialPostgres passwords, database URIs, Supabase tokens
Valid Share (Where Checkable)29%
export Statements
Share of Leaked Rules5%
Typical Exposed MaterialService-role keys, API keys, JWTs
Valid Share (Where Checkable)18%
Database CLIs (psql, mysql, mongosh, redis-cli)
Share of Leaked Rules4%
Typical Exposed MaterialConnection strings and inline -p passwords
Valid Share (Where Checkable)50% and above
Script One-Liners (node, python, npx)
Share of Leaked Rules3%
Typical Exposed MaterialKeys passed as positional CLI arguments
Valid Share (Where Checkable)20%
SSH Tools (sshpass -p, ssh user:pass@)
Share of Leaked Rules1%
Typical Exposed MaterialServer and root login passwords
Valid Share (Where Checkable)54%
Tool Rules (WebFetch, Read)
Share of Leaked Rules1%
Typical Exposed MaterialEmbedded URL credentials and token paths
Valid Share (Where Checkable)Low

That split explains why security operations teams cannot judge risk by raw occurrence volume alone. Half of all leaked allow rules come from curl commands whose short-lived bearer tokens frequently expire before an attacker replays them. By contrast, database CLI rules and sshpass invocations account for only 5% of volume yet show validity rates of 50% to 54% when verified automatically. Even worse, container registries amplify a single mistake: GitGuardian flagged one live Cloudflare API token embedded across 559 tags of a single Docker Hub image and one database password replicated across 643 tags spanning seven image repositories. Removing the file from git history does not purge already-pushed container layers.

The local security threat extends beyond accidental git pushes. As Apiiro’s researchers pointed out, an endpoint infostealer does not need to parse complex keychains when .claude/settings.local.json stores an indexed inventory of every staging server, API endpoint, and database password an engineer approved over recent sprints. Similar leakage patterns appear across Cursor, GitHub Copilot, and custom agent harnesses whenever command transcripts, session memory files, or handoff notes live inside the working tree.

Hardening Repositories, Docker Builds, and Agent Sessions

Platform engineering teams need controls at three separate boundaries: repository tracking, container build contexts, and runtime secret injection. Relying on an individual developer’s global git configuration leaves every newly cloned workspace exposed.

Terminal
# 1. Remove any accidentally tracked local Claude settings without deleting local file
git rm --cached .claude/settings.local.json 2>/dev/null || true

# 2. Enforce repo-level ignore rules across both Git and Docker build contexts
printf "\n# AI coding agent local state & transcripts\n.claude/settings.local.json\n.claude/projects/\n.claude/*.log\n" >> .gitignore
printf "\n# Prevent COPY . . from baking agent configs into container layers\n.claude/\n.cursor/\n" >> .dockerignore

# 3. Audit local allow rules for inline secrets before rotating credentials
grep -E "(PGPASSWORD|DATABASE_URL|Authorization:|Bearer |token|password|secret|sk-|ghp_)" .claude/settings.local.json

For production CI pipelines, add an explicit pre-receive or GitHub Actions policy check that blocks commits introducing .claude/settings.local.json, agent session logs, or workspace memory dumps regardless of whether a regex scanner recognizes a vendor token prefix. On developer workstations, instruct engineers never to paste literal secrets into an agent prompt or shell argument; instead, reference environment variables loaded from a secret manager (1Password CLI, AWS Secrets Manager, or Vault) so any persisted allow rule records $DATABASE_URL rather than the raw password string.

Next Steps
  1. Block .claude/settings.local.json in Both .gitignore and .dockerignore: Commit explicit ignore rules into every active repository template and add a CI check that fails any pull request attempting to track local agent permission files or chat transcripts.
  2. Audit Existing Git History and Container Tags Before Rotating: Scan historical commits and pushed Docker images for .claude/ paths, then immediately rotate every database URI, SSH password, cloud key, and npm token that ever appeared in an allow rule.
  3. Ban Literal Secrets in Interactive Agent Commands: Configure developer tooling to inject secrets through runtime wrappers such as op run or aws-vault exec, ensuring approved shell patterns reference variable names instead of raw credentials.
Beat: Topics:
#apiiro #claude-code #developer-security #gitguardian #secret-scanning

The Tuesday Intelligence Dispatch

The definitive weekly briefing engineering leaders and technical founders read before deploying AI models to production. Unvarnished latency audits, real-world token unit economics, and architectural teardowns—zero vendor hype, zero sponsored reviews, and 100% empirical verification.

Every Tuesday at 6 AM ET ✓ Tested in Real Environments ✓ Verified by Experts
Strictly no spam. We never share your data. 1-click unsubscribe anytime.
✓ Added to Dispatch

You’re all set!

Stay tuned for the upcoming Tuesday Intelligence Dispatch delivered at 6 AM ET.