Claude Code's "don't ask again" put thousands of passwords on GitHub: how to protect yourself
When you pick "Yes, and don't ask again" on a command in Claude Code, the whole command is saved to a project file, passwords included. On November 5, 2026, security firm Apiiro counted 2,539 secrets that reached public GitHub this way. If you use Claude Code for your sites or automations, here is what to check today.
Leggi questo articolo in italiano
What Apiiro found
Claude Code's "Yes, and don't ask again" option has carried thousands of passwords and API keys onto public GitHub. That is the finding of research by Apiiro, a software security company, published on November 5, 2026 by researchers Shmulik Cohen and Matan Giladi, as reported by RuntimeWire.
The data was collected between November 1 and 3, 2026. Apiiro examined 104,185 public copies of the .claude/settings.local.json file: 1,122 held at least one real secret, for a total of 1,379 distinct credentials. Widening the search to earlier versions of the file, the shared .claude/settings.json file and transcripts saved by agents, the count rises to 2,539 distinct secrets across 1,994 public repositories, belonging to 63 organizations, mostly software companies.
According to GBHackers, the secrets include 379 database passwords, 122 Supabase service-role keys, 103 Supabase account tokens, 43 SSH logins (some with root passwords inside sshpass commands), 23 AWS keys and 6 private keys.
Apiiro did not test the credentials or contact the hosts: "real secret" means credible credential material, not a key confirmed to work. One of the notified companies did confirm that its exposed key was still live.
Why it happens: the file that remembers commands
The mechanism is simple. When Claude Code asks permission to run a terminal command and you choose "Yes, and don't ask again", the official documentation explains that the approval is saved as an allow rule in the project's .claude/settings.local.json file. If the command contained a password typed in full, for example after PGPASSWORD= or mysql -p, the password lands in the file as-is.
Claude Code does try to protect you: the first time it writes that file in a git repository, it adds **/.claude/settings.local.json to your global git excludes on your machine. The problem, as Cybersecurity News explains, is that this protection stays on your computer and does not travel with the project: it does not cover files git already tracks, it does not apply on other machines and it does not reliably protect a folder that becomes a repository later.
The behavior is not new: a report on Claude Code's public issue tracker from August 2025 already described credentials saved in plain text in approved commands.
Why secret scanners are not enough
Many developers rely on tools that look for secrets before a push. Here they only half worked. Of the 1,122 files with secrets, Gitleaks flagged 564 and TruffleHog 643; 215 files were flagged by neither.
The reason, GBHackers explains, is that a password typed after PGPASSWORD=, sshpass -p or mysql -p has none of the recognizable prefixes that big providers put on their keys: to a scanner hunting for known formats it looks like any other word in a command.
There is also a long memory problem. Apiiro found 734 secrets that appear only in past versions of the file and in no current copy, and credentials from 74 repositories reproduced in 211 forks. Deleting the file today does not erase git history or copies made by others.
How to protect yourself in 5 steps
If you use Claude Code, these are the checks the sources recommend, in the right order:
- Rotate exposed credentials first. Passwords, tokens and keys that ever sat in that file must be changed before you clean the repository: git history, forks and clones keep them anyway.
- Stop tracking the file. Run
git rm --cached .claude/settings.local.jsonand add the path to the project's.gitignore, so the rule travels with the repository. - Check history and shared files. Search git history for the file and review
.claude/settings.jsontoo: passwords, tokens, connection strings and authorization headers do not belong inallowrules. - Do not type secrets into commands. Use environment variables or a secrets manager, so the approved command holds a reference, not the password.
- Add an automatic check. A pre-commit and CI scanner that also looks for passwords inside commands, not just API key formats, across agent folders and history.
One last note from Cybersecurity News: even if the file never reaches GitHub, it is still a plain-text file on your computer that malware could read.
What it means for you
If you use Claude Code to build your website, connect a database or automate your work, the lesson is practical: approving a command "forever" is convenient, but it saves that command forever, with everything inside it. Before you click, check whether the command contains a password; if it does, approve it once or rewrite it with a variable.
AI agents are becoming real coworkers, as we covered with Claude Duet and Anthropic's Agent Skills: to make them work well you need clear procedures, not just permissions. If you want to use Claude at work with a method, Claude Business OS collects 80 ready-made prompts for emails, documents and processes, and the AI Business Toolkit organizes the AI tools for everyday work. If you are building a website with AI, Website AI University walks you through it step by step.
For a complete path on content, video and automation with AI, there is The AI Creator System.
Frequently asked questions
What does Claude Code's "Yes, and don't ask again" option do?
It saves the command you approved as an allow rule in the project's .claude/settings.local.json file, so Claude Code stops asking permission for that command. The command is saved in full, including any password typed inside it.
How many secrets did Apiiro find on GitHub?
Apiiro found 1,122 settings.local.json files with real secrets out of 104,185 public copies, and 2,539 distinct secrets in total across 1,994 public repositories, counting past versions, shared files and transcripts. The research was published on November 5, 2026.
Doesn't Claude Code already keep the file out of git?
Yes, but only on your computer: the first time it writes the file in a repository, Claude Code adds it to your global git excludes. That rule does not travel with the project and does not cover files already tracked, so you should also add the path to the repository's .gitignore.
If I delete the file from the repository, am I safe?
No. The file stays in git history, forks and clones. The first step is to rotate every password, token and key the file ever held, then stop tracking the file and clean the history.
Are Gitleaks or TruffleHog enough to find these secrets?
Not always. Of the 1,122 files with secrets, Gitleaks flagged 564 and TruffleHog 643, while 215 were flagged by neither, because passwords inside commands have no recognizable format.
Read next



Sources checked on November 8, 2026
- Cybersecurity News — Claude Code's "Yes, and Don't Ask Again" Option Can Leak Passwords and API Keys to GitHub, di Guru Baran (7 novembre 2026)
- GBHackers — Claude Code's "Don't Ask Again" Feature Exposes 2,539 Secrets Across 1,994 GitHub Repositories (7 novembre 2026)
- RuntimeWire — Claude Code's "don't ask again" option exposed passwords in 1,122 public GitHub files, di Ryan Merket (7 novembre 2026)
- Documentazione ufficiale di Claude Code — Settings files and precedence