Claude Code settings.local.json Secrets Audit: 1,122 Leaked Repos, Permission Overrides and Rotation Checklist
Apiiro’s security audit reveals 1,379 plaintext secrets across 1,122 public repositories due to flawed local git exclude behavior, prompting urgent developer credential rotation.

THE STORY IN THREE POINTS
- A security audit across 104,185 public repositories found 1,122 instances of .claude/settings.local.json containing 1,379 exposed credentials, including 379 database passwords, 23 AWS keys, and 43 SSH logins.
- Claude Code appends settings.local.json to the local machine’s global git exclude, a safeguard that does not follow repository clones, leaving existing tracked files and forks vulnerable.
- Standard secret scanners missed 215 of the exposed credentials because commands like PGPASSWORD= lack vendor prefixes, requiring manual inspection and credential rotation.
The 1,122 repository credential leak and scanner blind spots
An empirical security investigation conducted by cybersecurity firm Apiiro revealed widespread plaintext secret exposures tied to autonomous developer agents. Auditing 104,185 public repositories on GitHub containing .claude directories, researchers discovered 1,122 public settings.local.json files exposing 1,379 verified active secrets, spanning 379 database credentials, 23 AWS access keys, 43 SSH private logins, and proprietary API tokens from 63 major organizations.
Crucially, automated CI secret detection proved inadequate: popular scanners like gitleaks identified only 564 instances, while TruffleHog detected 643. Exactly 215 repositories slipped past both scanners entirely because developer approvals embedded inline commands such as PGPASSWORD=, sshpass -p, or mysql -p, which lack rigid vendor-specific string prefixes. Threat actors operating npm worms like Shai-Hulud are already targeting developer workstations scanning for these unencrypted files.
Why global git exclude fails to protect cloned repositories
The fundamental vulnerability stems from architectural friction between repository isolation and local tool approvals. When Claude Code executes in a workspace, it records standing permissions—such as bash command approvals—inside .claude/settings.local.json. To prevent accidental commits, Claude Code appends the path to the current user’s global git exclude file (~/.config/git/ignore).
However, global exclude rules are machine-local: they do not transfer when a repository is cloned by teammates, pushed to CI runners, or forked. Furthermore, if a developer runs git add . in a repository where settings.local.json was already staged prior to initialization, Git honors index tracking over the global exclude. Apiiro identified 509 repositories where secrets persisted in historical commit trees and 211 public forks carrying identical credentials.
Remediation protocol: Immediate key rotation and repo cleanup
Developers using Claude Code must immediately inspect their local workspaces: running git status --ignored verifies whether .claude/settings.local.json is properly ignored. If credentials have ever been committed, simply deleting the file is insufficient—developers must rotate all database connection strings, revoke cloud provider keys, and purge git commit histories using git-filter-repo.
Teams should explicitly add .claude/settings.local.json to the repository-root .gitignore file and migrate environment secrets to external secret vaults or OS keychain daemons, ensuring autonomous CLI agents never store plaintext authentication tokens in local approval logs.
Sources: Apiiro Research: 1,379 Secrets Exposed Across Claude Code Settings Files|Apiiro Security ↗ Claude Code Developer Guide: Configuration & Tool Permissions|Anthropic Documentation ↗
THE BROADER CONTEXT · CLAUDE DOSSIER
Explore full product specifications, pricing analysis, and continuous coverage in the Claude Desk Hub. Independent benchmarks available on the AI Intelligence Index and Coding Agents Leaderboard.


