← Back to blogs

Claude Code Leak Exposes 1,122 Secrets on GitHub

Claude Code saved passwords and API keys in plain text when users picked "Don't Ask Again". Apiiro found 1,122 public GitHub files holding 1,379 secrets.

Passwords and API keys that developers typed into commands are sitting in public GitHub repositories, where anyone can read them. Security firm Apiiro said on November 5 that 1,122 public copies of a Claude Code settings file hold at least one secret. The cause is a single click: "Yes, and don't ask again."

How one click saves your password

Claude Code is Anthropic's AI coding assistant. By default, it asks before it runs most shell commands. If the user picks "Yes, and don't ask again," it saves an allow rule in a project file called .claude/settings.local.json, so matching commands run without asking in later sessions. The rule covers only what the prompt offered. Sometimes that is a pattern, such as npm test with a wildcard. Sometimes it is one exact command. When it is the exact command, any password or token typed into it is saved too, in plain text. Claude Code tries to keep the file out of git. The first time it writes the file in a git repository, it adds the file to the user's global git excludes, so git ignores it on that computer. But that protection stays on one computer. Claude Code never adds the file to the project's own .gitignore, so the protection does not travel with the project. If the file is committed and pushed, the secret goes with it.

What Apiiro found

Apiiro searched public GitHub and found 104,185 copies of the file in 103,617 repositories. About 1.1 percent of them, or 1,122 copies, hold at least one secret. Together they hold 1,379 different secrets. More than a third of the secrets open a database directly, including 379 database passwords. The rest include 43 SSH logins for public servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. Among the owners of these files are 63 organizations, mostly software companies. The strongest cases include a database vendor's own admin-level cloud key and the owner password of a medical-records database. One company the researchers notified confirmed its key had been live. Counting git history, the shared settings file that teams commit on purpose, and saved agent chat logs, the total rises to 2,539 secrets across 1,994 repositories. Apiiro did not test whether the credentials still work, and it does not say whether anyone has used them. Apiiro also compared 16 coding agents. Claude Code was the only one confirmed to save the full approved command in a project file by default.

The leak is hard to undo

As of Monday, November 2, every file with a secret was still on its repository's default branch. In half of those repositories, it had been there for at least 217 days. Removing the file does not undo the leak. Older versions stay in git history, and forks spread the files further: 211 forks of 74 repositories carry the same secrets as the originals. Older versions of the file hold 734 more secrets across 509 repositories that no longer appear in any current copy. Common secret scanners miss many of these files. The researchers ran gitleaks and TruffleHog over every copy. Gitleaks flagged 564 of the 1,122 files with a secret, TruffleHog flagged 643, and neither flagged 215. Most misses are passwords typed inside commands, which look like ordinary words to a scanner. Users reported this behavior before. A bug report filed on August 11, 2025 said approved commands with API keys and tokens were being stored word for word in settings.local.json. An automated bot closed that report as "not planned" on January 3, after 60 days without activity. The researchers cite four related reports, all closed by the same bot, most recently on November 6. None got a reply from Anthropic, they say.

What to do now

The researchers recommend that developers search their GitHub organization for .claude/settings.local.json and .claude/settings.json, and check each repository's git history for them, even where the files are gone. Rotate every password, token and key the files have ever held before cleaning up, because deleting the file does not revoke the secret. Then stop tracking the local file and add it to the repository's own .gitignore. Open the file on your own computer, even if it was never committed, and delete every rule that contains a secret. Going forward, keep secrets out of commands. Refer to them as variables from a secrets manager, such as $DB_URL, so the saved rule holds the variable name and not the secret. Approve patterns, such as Bash(npm run: with a wildcard), instead of single commands. For security teams, the researchers recommend treating agent folders such as .claude, .cursor, .gemini and .specstory, and agent memory files, as holding secrets, like .env files. Add them to pre-commit and CI secret scanning, including git history, and add .claude/settings.local.json to the organization's .gitignore templates.

Sources

- The Hacker News - https://thehackernews.com/2026/11/claude-codes-dont-ask-again-file.html - Apiiro - https://apiiro.com/blog/coding-agents-leaking-secrets-github-dont-ask-again

Source: The Hacker News ↗

LET'S CONNECT

Start a conversation.

See our Privacy Policy.

Your inquiry will be saved for the Histic team to review.

EVENT REGISTRATION

See our Privacy Policy.