← BACK TO FEED
Claude Codecredential leakGitHub securityAnthropicsecret scanning

Claude Code Is Leaking Passwords Into Public GitHub Repos and Anthropic Keeps Closing the Bug Reports

Claude Code's "don't ask again" feature saves approved shell commands verbatim — including any embedded passwords or API keys — into a project settings file (`.claude/settings.local.json`), which has been found in over 1,100 public GitHub repositories containing at least 1,379 exposed secrets, including database passwords, SSH credentials, and AWS keys. While Claude Code attempts to exclude the file from git on the user's local machine, it never adds it to the project's own `.gitignore`, meaning it can be accidentally committed and persists in git history and repository forks even after deletion. Security firm Apiiro advises affected developers to immediately rotate any exposed credentials, retroactively clean git history, and avoid embedding secrets directly in commands by using variable references instead.

Security researchers at Apiiro have found 1,122 public GitHub repositories containing Claude Code's settings file with live credentials inside. Passwords, API keys, SSH logins, database tokens. Sitting there in plain JSON, committed to public repos, some for the better part of a year.

Here's how it happens. Claude Code asks permission before running shell commands. When a developer clicks "Yes, and don't ask again," Claude saves the approved command verbatim into a project file called .claude/settings.local.json. If the command contained a password or API key, that secret is now written to disk in plain text. No redaction, no warning.

Anthropus says Claude Code tries to prevent the file from being committed, by adding it to the user's global git excludes the first time it creates it. That protection lives on one machine, in one user's git config. It doesn't travel with the project, it doesn't go in the repository's own .gitignore, and it does nothing for a file that was already committed before that protection was set up. In 539 of the 1,105 repositories Apiiro examined, a commit co-authored by Claude added or modified the file. So yes, the tool is frequently committing its own secret-containing config file.

Apiiro searched GitHub and found over 104,000 copies of the file across roughly 103,600 repositories. About 1.1% of those contained at least one verifiable secret. Collectively, 1,122 files hold 1,379 distinct credentials.

The breakdown is grim. Database passwords account for 379 of them. There are 43 SSH credentials for publicly reachable servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. Among the affected organisations are 63 companies, including a database vendor whose own admin-level cloud key was exposed, and whoever is running a medical records database with its owner password committed to a public repo.

As of Monday, every file containing a secret was still present on its repository's default branch. Half of them had been sitting there for at least 217 days.

Deleting the file doesn't fix anything, by the way. Git history is permanent unless you explicitly rewrite it. Forks compound the problem. Apiiro found 211 forks across 74 repositories that inherited the same secrets from their upstream sources. Older versions of these files contain a further 734 secrets that have since been deleted from current copies but remain accessible in history.

If you include the shared .claude/settings.json file (which teams intentionally commit), old file versions, and saved agent chat logs, the total climbs to 2,539 secrets across 1,994 repositories.

Standard secret scanning tools don't catch most of this. Apiiro ran both gitleaks and TruffleHog over every affected file. Of the 1,122 flagged by human review, gitleaks caught 564, TruffleHog caught 643, and 215 slipped past both entirely. The issue is that scanners look for recognisable key formats. A password buried inside a shell command like PGPASSWORD=hunter2 psql looks like noise to a pattern matcher.

Of the sixteen AI coding agents whose documentation Apiiro reviewed, Claude Code is the only one confirmed to save the full approved command text, secrets and all, to a project-level file by default.

This isn't news to anyone paying attention. A bug report filed in August 2025 described exactly this behaviour, with approved commands containing API keys being stored word for word in settings.local.json. An automated bot closed it as "not planned" after 60 days without activity. Four related reports have now been closed by the same bot. None received a response from Anthropic.

What should you actually do about this? First, rotate everything. Before you clean up any files, change every credential that has ever appeared in these settings files. Then run a search across your GitHub organisation for both .claude/settings.local.json and .claude/settings.json, and check git history, not just current branches. Use git rm --cached to stop tracking the local file, add it to your project's .gitignore, and open the copy on your own machine to delete any rules containing secrets.

Long term, stop putting secrets in commands. Use environment variables or a secrets manager and reference them by name, so what gets saved to disk is $DB_URL rather than the actual password. Approve command patterns rather than specific commands where possible.

Security teams should treat agent config folders, .claude/, .cursor/, .gemini/ and similar, the same way they treat .env files. Assume they can contain secrets, scan them accordingly, and add them to gitignore templates across the organisation.

READ NEXT
Anthropic quietly buried hidden tracking code in Claude Code. Now it's removing it.How a Lobster Mascot and a Bunch of Obsessives Dragged the AI Agent Era Into ExistenceAnthropic Quietly Fixed a Claude Code Sandbox Bypass Nobody Told You About