TL;DR
Security firm Apiiro scanned public GitHub and found 1,122 copies of Claude Code’s local settings file carrying real credentials โ production database passwords, cloud keys, payment processor tokens and SSH root logins. The cause is the “Yes, and don’t ask again” button: it saves the approved shell command word for word, secret included, into a project file that git does not reliably ignore. Deleting the file today does not undo it, because old commits and forks keep the password.
What Claude Code’s “Don’t Ask Again” button actually saves
Claude Code asks for permission before it runs a shell command, and then it asks again for the next one. Apiiro’s researchers note the practical consequence: after roughly the tenth interruption in a session, most people stop reading the command and start clicking. That is the moment the “Yes, and don’t ask again” option exists for.
What that option does is more literal than most developers assume. It does not save “this class of command”. It saves the command text as an allow rule in .claude/settings.local.json, at the root of the git repository. Anthropic’s permissions documentation describes the grant as permanent for that repository and that command, applying to future sessions anywhere in the repo, including git worktrees.
So consider the ordinary case Apiiro describes: you ask Claude Code to check a row in a staging database. It proposes:
PGPASSWORD='Str0ngPassw0rd!' psql -h db-staging.acme-my.com -U admin -d app
You approve it once, with “don’t ask again”, because you want to get back to work. The allow rule is now that exact string. The password is not a variable reference. It is not pulled from a keychain. It is a line of text inside a file in your project folder, sitting next to your source code.
Apiiro reproduced the behaviour with the latest models, Opus 5.5 and Fable 5.1. In a comparison of documentation for 16 coding agents, Claude Code was the only one they could confirm writes the full approved command into a project file by default. And the underlying behaviour is not new: a bug report on Claude Code’s GitHub tracker described plaintext credentials being stored as-is in approved commands back in August 2025.
Why the command text is the problem
Pattern-based approvals would be safe. If the saved rule were Bash(npm run:*), nothing sensitive lands on disk. But when Claude Code proposes a one-off command and you grant a standing approval, the rule is the literal invocation โ and any credential the assistant inlined to make the command work becomes durable configuration data.
That is the whole mechanism. No attacker, no poisoned prompt, no exploit. A developer accepted a convenience prompt and the tool wrote the password down.
What Apiiro found on public GitHub
Apiiro searched GitHub’s public code and commit history between 1 and 3 November 2026 and published the findings on 5 November. The headline numbers:
| Measure | Count |
|---|---|
Public copies of .claude/settings.local.json |
104,185 |
| Repositories holding those copies | 103,617 |
| Copies containing at least one real secret | 1,122 (about 1.1%) |
| Distinct secrets in those current files | 1,379 |
| Organisations identified | 63 |
| Distinct secrets once history, shared settings and transcripts are counted | 2,539 |
| Repositories in that wider count | 1,994 |
Inside those 1,122 files, 636 values matched a known provider key format and 743 were passwords or tokens sitting next to a public host address. The breakdown of what was exposed:
| Credential type | Count |
|---|---|
| Database passwords | 379 |
| Supabase service-role keys | 122 |
| Supabase account tokens | 103 |
SSH logins for public servers (some root, inside sshpass commands) |
43 |
| GitHub, GitLab and npm tokens | 42 |
| AWS keys | 23 |
| Private keys | 6 |
More than a third of the secrets open a database directly. Apiiro describes the worst cases without naming the organisations: a database vendor’s own cloud key with manage access, a startup’s production database password, a software agency’s payment processor access token, and an IT services firm whose medical-records application exposed its database owner password. One of the 63 organisations confirmed to Apiiro that its exposed key had been live.
An important limit on the claim: Apiiro did not test whether the credentials still work and did not contact the exposed hosts. “Real secret” means credible credential material โ a key in a recognised format, or a password next to a reachable host that an AI reviewer agreed was a credential. Exposure is proven. A live breach is not.
Why the built-in git ignore does not save you
Claude Code does try to keep this file out of version control. The first time it writes .claude/settings.local.json inside a repository, it adds **/.claude/settings.local.json to your global git excludes file โ core.excludesFile, which defaults to ~/.config/git/ignore (or %USERPROFILE%\.config\git\ignore on Windows).
That protects one machine. It fails in at least four ordinary situations:
- The folder became a repository later. If the directory was not a git repo when Claude Code first wrote the file, no exclude was added. Running
git initafterwards changes nothing retroactively. - You (or a teammate) created the file by hand. Anthropic’s docs say you then have to add it to
.gitignoreyourself. - Git already tracks the file. Ignore rules do not apply to tracked files. Once it is committed, it goes out again with every change.
- The project is published as an npm package. npm selects files using the package’s own
.npmignoreor.gitignore, not your global git config, so the settings file can be packed into a published tarball. Lakera scanned about 46,500 npm packages and found the file in 428 of them; in 30 it contained credentials, including npm publish tokens and GitHub access tokens.
The exclude rule also never goes into the repository’s own .gitignore, so nothing travels with the project to a teammate’s clone or a CI runner.
Apiiro’s data suggests the agent is often the one doing the committing. In 539 of the 1,105 repositories it traced, a commit that listed Claude as co-author changed the settings file. And the exposure is not transient: half of the secret-bearing files had been sitting on a default branch for at least 217 days.
Why gitleaks and TruffleHog missed 215 of these files
Running a secret scanner over your repositories does not settle the question. Apiiro ran both common tools over all 104,185 files:
| Tool | Files flagged |
|---|---|
| gitleaks | 564 |
| TruffleHog | 643 |
| Neither | 215 |
The miss pattern is consistent. Scanners are built to recognise shapes: AKIAโฆ for AWS, ghp_โฆ for GitHub, sk-โฆ for API keys. A password typed after PGPASSWORD=, -p in a mysql command, or sshpass -p has no vendor prefix. To a regex tuned for key formats, it reads as an ordinary word in an ordinary command line.
If you maintain scanning rules, add a command-embedded credential pattern. A minimal gitleaks custom rule looks like this:
[[rules]]
id = "command-embedded-credential"
description = "Password passed inline in a shell command"
regex = '''(?i)(PGPASSWORD|MYSQL_PWD|REDISCLI_AUTH|PGPASSFILE)=[^\s"'`]+'''
tags = ["password", "claude-code"]
And because scanners are easy to forget locally, run one in the pipeline as well as on the laptop. A pre-commit hook that scans only staged files costs a second or two:
#!/usr/bin/env bash
# .git/hooks/pre-commit
git diff --cached --name-only -z \
| xargs -0 gitleaks protect --staged --redact --verbose
Neither the hook nor the custom rule fixes the underlying issue โ a secret in a file is a secret in a file. They just stop the next one from being committed.
The surface is wider than one file
The 1,122 number understates the problem because it counts only current copies of the local settings file. Apiiro’s broader measurement, which reaches 2,539 distinct secrets across 1,994 repositories, adds four more places secrets accumulate:
| Location | Exposure |
|---|---|
| Older commits no longer in the live file | 734 secrets in 509 repositories |
Shared .claude/settings.json (committed on purpose) |
298 of 76,011 copies |
| Saved agent chat transcripts | 120 secrets across 87 repositories |
| Agent memory files | present in 9 repositories |
| Deployment and handoff notes | 33 (a third written by the agent itself) |
| Forks | 211 forks of 74 repositories carry the same secrets |
The shared settings file is the awkward one for teams. .claude/settings.json is the file you commit so that everyone gets the same permissions, and the VS Code extension’s approval card lets you choose which file a rule lands in โ including that shared one. In the CLI, approvals go only to the local file, which is the safer default, but it also means a rule that works for one developer is invisible to the rest of the team.
Forks matter because they multiply: cleaning the original repository does nothing about 211 derived copies you may not control.
Then there is the malware angle, which is why a plaintext credential file on a laptop still counts as a security problem even if your repo is private. The Shai-Hulud npm worm in September 2025 downloaded TruffleHog and ran it across infected developer machines to harvest credentials. Weeks earlier, malicious Nx packages tried to enlist the developer’s locally installed Claude Code and Gemini clients in the same hunt.
What this means for Malaysian developers and teams
Claude Code is widely used here, especially in the startup and agency scene, and the toolchain around it makes the exposure pattern likely rather than exotic. A typical Malaysian stack in 2026 is Supabase or a managed Postgres instance, a payment gateway, and a small team where the same two or three people hold production keys. Two of the most common secret types in Apiiro’s data โ 379 database passwords and 122 Supabase service-role keys โ map exactly onto that setup. A leaked service-role key bypasses row-level security entirely.
Four things worth flagging for local teams:
Client work is the sharp edge. Agencies in KL and Penang routinely clone client repositories and run agents inside them. A settings file committed by an agency developer lands in the client’s repository, and the client may not have the tooling to notice. If you do contract work, add “no agent configuration committed” to your delivery checklist alongside .env.
Your compliance position is no longer purely technical. The 2024 amendments to Malaysia’s Personal Data Protection Act introduce mandatory breach notification and data protection officer obligations for many organisations. A production database password for a system holding customer records is a data-protection matter, not just an engineering one, and “we did not know it was there” is a weak position once the file has been public for months. Financial institutions answer to Bank Negara’s technology risk policy, which is stricter again.
Rotating is cheaper than the alternative. A password rotation across a dozen services costs an afternoon and an outage window. The cost of a live database credential in a public repository โ notification, forensic review, regulator engagement, client trust โ is measured in weeks and ringgit.
Small organisations are represented in the data. Apiiro’s 63 affected organisations span student and hackathon groups, startups, software agencies and established vendors. This is not a problem reserved for companies with security teams.
How to check and clean up your own projects
The order matters, and Apiiro is explicit about it: rotate first, clean second. Deleting the file does not delete the commits, forks, clones or backups that already contain the credential.
Step 1 โ Find the rules that carry a secret
Look inside every project you have run an agent in:
# List the settings files git knows about
git ls-files | grep -E '^\.claude/settings(\.local)?\.json$'
# Show the approval rules that look credential-bearing
grep -nEi 'PGPASSWORD|sshpass|mysql -p|Bearer |api[_-]?key|token|secret' \
.claude/settings.local.json .claude/settings.json 2>/dev/null
Read the allow list by hand as well. Plain passwords after -p will not match any pattern you write.
Step 2 โ Rotate everything that file ever held
Every password, token and key that appears in a rule. Then check the database side: if a credential was public, assume it was read. Look for authentication from unexpected addresses in your provider’s logs, particularly for root SSH logins and service-role keys.
Step 3 โ Untrack the file and ignore it in the repository, not on your machine
git rm --cached .claude/settings.local.json
printf '\n# Claude Code local settings (may contain credentials)\n.claude/settings.local.json\n' >> .gitignore
git add .gitignore && git commit -m "chore: stop tracking Claude Code local settings"
If the shared .claude/settings.json has a credential in it, treat that as a code change: remove the rule, open a PR, and rotate the secret in the same breath.
Step 4 โ Search history, not just the working tree
# Commits that ever introduced or removed the pattern
git log --all --oneline -S'PGPASSWORD=' -- '.claude/'
# Every blob in history that contains the file
git rev-list --all --objects | grep 'settings.local.json'
If history is dirty, git filter-repo (or the GitHub support path for a public repo) is the only way to rewrite it โ and rewriting does not reach existing forks, so rotation is still the fix that counts.
Step 5 โ Change how you approve
- Approve patterns, not literal commands:
Bash(npm run:*),Bash(git status). - Never let a credential appear inline in a command the agent proposes. Put it in the environment or a secret manager, and have the command read
$PGPASSWORD/$DATABASE_URLinstead of a literal. - If the assistant has already written a command with a bare secret, do not approve it with “don’t ask again”. Edit the command first.
- Add
.claude/,.cursor/and.gemini/to the paths your secret scanning covers โ on laptops as well as remotes.
What should change upstream
The finding is structural rather than a one-off bug. Claude Code’s documented behaviour โ approvals persist permanently, per repository and command โ is what turns a convenience click into a permanent record. Apiiro’s publication is a measurement study; it does not describe a patch, and the exposure path remains as documented.
Three changes would close most of it, and they are worth asking vendors for:
- Strip credential-shaped arguments before persisting a rule. If a proposed command contains
PGPASSWORD=, a bearer token or a-ppassword, save a redacted pattern instead of the literal text, and tell the user it was redacted. - Write the ignore rule into the repository’s
.gitignore, not the user’s global excludes. The current behaviour protects the machine that created the file and nobody else. - Warn at approval time. A single line โ “this command contains what looks like a password and will be saved to a settings file” โ would have prevented most of the 1,122 files, because the developer’s mental model is that they are granting permission, not recording a secret.
Until then, the control is procedural. Treat .claude/settings.local.json the way you treat .env: a file that may contain production credentials, that never belongs in a repository, and that gets rotated the moment it escapes.
FAQ
Did someone hack these GitHub repositories?
No. Apiiro found no attacker in the chain. A developer approved a command containing a credential, Claude Code saved the command as an allow rule, and the file ended up in a public repository through ordinary git usage โ including commits the agent itself co-authored.
I use Claude Code but my project is not a git repository. Am I safe?
Not necessarily. If the folder becomes a repository later, no exclude rule was ever added, so the first git add . can pick the file up. The file can also reach the public through npm publishing, which uses the package’s own ignore files rather than your global git config.
Are the exposed credentials confirmed to still work?
Apiiro did not test them and did not contact the exposed hosts. One of the 63 affected organisations confirmed that its key had been live. Treat every exposed credential as compromised regardless โ the cost of rotating is far below the cost of assuming it was already revoked.
I deleted the settings file. Is the problem solved?
No. Older commits held 734 secrets that were no longer in the current file, and 211 forks across 74 repositories carried the same secrets as the originals. Rotation is the only step that actually removes the risk; deletion and history rewriting only remove the copies you can see.
Do other coding agents have the same problem?
Apiiro compared documentation for 16 agents and could confirm only Claude Code writes the full approved command into a project file by default. That does not clear the others โ any agent that persists project-level configuration should be checked, and the files are easy to find: look for a settings or config directory inside the repository and read the allow list.
Conclusion
The “don’t ask again” button is a reasonable feature. What went wrong is what it remembers: not “this command is allowed”, but the command itself, with the password still in it, stored in a file that git ignores only on the machine where it was created.
The numbers are the argument. 104,185 public copies, 1,122 with real secrets, 215 that two industry-standard scanners both missed, 63 organisations, one confirmed live key โ and a mechanism that involves nobody doing anything more reckless than accepting a convenience prompt. Half of those files had been exposed for over 200 days.
If you have run Claude Code inside a repository, do one thing today: open .claude/settings.local.json and read the allow list. If a password is in there, rotate it before you delete anything, then untrack the file and put the ignore rule in the project’s own .gitignore. The convenience was always going to be paid for somewhere; better an afternoon of rotation than a headline with your company’s name in it.
More from ZFRBuild
- Christmas Eve 2026: parades, fireworks and food fairs
- Start Doing Graph Theory
- Websites Should Be Printable
Related Article
- Why did some Apollo missions carry a grenade launcher? โ Apollo 14 and 16 carried a four-barrel grenade launcher to map the Moon’s subsurface with seismic waves โ and most of the grenades never fired.
