Back to Explore
NewsVibeFix editorialUpdated Nov 11, 2026

One click on 'don't ask again' put 2,539 secrets in public repos: how Claude Code remembers too much

Apiiro's November 5 research found that Claude Code saves commands approved with 'don't ask again' verbatim into .claude/settings.local.json — database passwords and API keys included — and the file then travels with the code into public repositories. Of 104,185 copies on GitHub, 1,122 hold a real secret; the total is 2,539. It was first reported in August 2025, and all four reports were closed by a bot.

The Hacker News illustration for the story: Claude Code's 'Yes, and don't ask again' option above a .claude/settings.local.json file with the password redacted.

On November 5, security company Apiiro published research about a very ordinary habit of Claude Code: click "Yes, and don't ask again" once, and it writes the entire command, word for word, into .claude/settings.local.json inside the project. If that command carries a database password or an API key, the secret goes into the repository along with the code. The researchers scanned 104,185 copies of this file on GitHub and found a real secret in 1,122 of them; counting earlier versions, the team-shared configuration file, and saved chat transcripts, the total is 2,539 secrets in 1,994 repositories. This is not a hack. It needs no exploit — only a developer clicking the most ordinary button in a normal workflow.

The Hacker News illustration for the story: Claude Code's 'Yes, and don't ask again' option above a .claude/settings.local.json file with the password redacted.

1. From "don't ask again" to a public repository: how the chain completes itself

Start with the mechanism. Claude Code asks before it runs a shell command; if you pick "Yes, and don't ask again", it saves that allow rule in .claude/settings.local.json inside the project folder. The rule is not a pattern like "allow psql" — it is the command itself, exactly as approved. If the command carries a password after PGPASSWORD=, sshpass -p, or mysql -p, or a bearer token inside a curl call, the secret is written to disk verbatim, sitting in a plain JSON file.

What the saved rule actually looks like is shown in The Hacker News illustration for the story: a command such as psql --password=••••• written into the allow list, command name and all. That is not an invented example — it is how this mechanism genuinely writes rules. Whatever is inside the command you approved is inside the file.

The file is meant to stay on the developer's own machine, and Claude Code does try to protect it: the first time it writes the file inside a git repository, it adds the file to the user's global git excludes, after which git on that computer ignores it. But that protection has three holes. First, it only covers the current computer and the current repository; it does nothing for a file that was already committed. Second, it does not cover a folder that becomes a repository later — write the file first, run git init second, or clone onto another machine, and the protection is gone. Third, it never writes the file into the project's own .gitignore, so the protection does not travel with the project; change person or machine and it stops working.

Worse, in many cases it is not a person who commits the file at all — it is Claude itself. In 539 of the 1,105 repositories the researchers traced, a commit listing Claude as a co-author changed the file. The researchers' reading is that Claude often commits the file itself. In other words, Claude writes the secret, Claude commits it, and the human only clicked "don't ask again" in between. No step in that chain looks like a mistake; every step is normal operation — which is exactly what makes it so hard to deal with.

The researchers also confirmed this is not a problem with one model version. They reproduced the behavior with Anthropic's latest models, Opus 5.5 and Fable 5.1, and concluded it is Claude Code's own behavior, independent of the underlying model. Changing models will not fix it; changing how you work will.

2. The numbers: 1.1% sounds small; the absolute count is frightening

The data was collected between November 1 and 3 using GitHub code search. There are 104,185 public copies of .claude/settings.local.json, spread across 103,617 repositories. Of those, 1,122 copies — about 1.1% — hold at least one real secret, 1,379 distinct secrets in total: 636 keys in known provider formats and 743 passwords or tokens sitting beside the address of a public server. A value counted as a "real secret" when it matched a known key format, or when a password or token sat beside a public server's address, and an AI reviewer also had to agree.

Broken down, the largest group is third-party service API tokens at 398, followed by database passwords at 379; then AI model API keys at 149, Supabase service-role keys at 122, Google API keys at 110, Supabase account tokens at 103, SSH server logins at 43, GitHub, GitLab and npm tokens at 42, AWS keys at 23, private keys at 6, and app and account passwords at 9. Of these, 501 open a database directly — 379 database passwords plus 122 Supabase service-role keys. The Supabase account tokens are worse: 103 tokens that control every project in the account.

Sixty-three organizations are affected, mostly software companies of all sizes. The cases the researchers name would each be a news story on their own: a database vendor's own admin-level cloud key, with manage access and no expiry claim, plus the cluster host; a B2B startup's production Azure Postgres password; a software agency's Square production access token; the owner password of a cloud Postgres database belonging to a medical-records app; an OpenAI-format key and an npm token in an open-source project with over a thousand stars. Nobody meant to publish a key — the key was in a command, the command was approved, and the file was committed with everything else.

The time dimension makes it worse. As of Monday, November 2, every file holding a secret was still on its repository's default branch; in the median repository with a real secret, the file had first been committed 217 days earlier, and in 118 repositories more than a year earlier. Forks spread them further: 211 forks of 74 repositories carry the same secrets. Deleting the file does not help either: earlier versions hold 734 more real secrets across 509 repositories that appear in no current copy, usually because the file was deleted. Adding the team-shared configuration file .claude/settings.json, with 298 secret-holding files out of 76,011 checked, and agent chat transcripts saved in repositories, with 120 files in 87 repositories, the total comes to 2,539 distinct real secrets in 1,994 repositories. The researchers warn that GitHub is only where they could count: the same file sits in plain text on every laptop where someone clicked "don't ask again", and it can also end up inside an npm package, a Docker image, a zip archive, or a synced folder.

3. Not one file: shared configuration and chat transcripts leak too

settings.local.json is the clearest case, but not the only one. The team-shared configuration file .claude/settings.json leaks as well: of the 76,011 copies the researchers checked, 298 hold a real secret, mostly inside allow rules. This file is different in kind from the local one — teams commit it on purpose, to hold allow rules everyone shares. The intent is "we have all approved this command"; the result is "we have all approved this command with a key in it". The local file's problem is accidental commit; the shared file's problem is deliberate commit of something that should not have been committed, which is harder to guard against because it follows the normal process.

One layer further out are the chat transcripts agents save. The researchers checked 2,523 saved agent session records in repositories — including .specstory, Aider, and Cursor exports — and 120 files in 87 repositories hold a real secret. Agent memory files are the same story; a MEMORY.md can hold a key too. The logic is the same throughout: to "remember context", an agent writes down what it did, and what it did includes commands carrying keys. Transcripts and memory files do not carry the "local" label a configuration file does, and many people never realize they need protecting too.

Adding the layers together completes the researchers' total of 2,539: 1,379 in current versions of the local file, 734 in earlier versions, and 426 more in shared configuration, chat transcripts, and memory files. The composition matters more than the total: the leak is not a defect in one file but a property of a whole chain in which "the agent writes down what it did", and at every step something is written into the repository while nobody is responsible for removing the keys.

4. Why ordinary secret scanners miss them

The researchers ran the two mainstream scanners over all 1,122 secret-holding files: gitleaks flagged 564, TruffleHog flagged 643, and 215 were flagged by neither — roughly one in five escapes both. Almost everything missed is a password inside a command: scanners recognize the shape of a key, such as a provider prefix or a long random string, while a password after PGPASSWORD=, sshpass -p, or mysql -p, or a bearer token inside a curl call, is formatted as an ordinary word in an ordinary command line, and the scanner has no reason to look twice.

This blind spot does not belong to this one file. The researchers note that the same "password inside a command" pattern appears wherever an agent records what it ran: transcripts, memory files, handoff notes — anywhere an agent writes down its own actions verbatim, a format-tuned scanner goes blind in the same place. That is why they advise security teams to extend scanning to git history and to add detection rules for passwords inside commands: scanning only current files and only known key formats checks just half the problem.

No single line of defense can be expected to catch this on its own, and that is exactly why defense in depth matters. A pre-commit check catches some, CI scanning catches some, GitHub push protection catches some — but every one of those recognizes "things that look like keys", and a password in a command specifically does not look like a key. So one of the researchers' recommendations is easy to overlook: scanning rules should specifically cover the "password in a command" pattern, such as PGPASSWORD, sshpass, mysql -p, and Authorization headers in curl. Without changing the rules, more tools just mean more of the same eyes. The more fundamental fix is at the source: never let a key appear on a command line. Keep keys in environment variables and secret managers, and let commands contain only variable names — then even if a rule is saved verbatim and the file is committed, there is nothing usable inside it.

One more number is worth singling out: the researchers compared the documentation of 16 coding agents, and Claude Code is the only one confirmed to save the full approved command in a project file by default. Other agents are not necessarily clean — the researchers only say "not confirmed", not "absent" — but within the verified range, Claude Code stands alone. That narrows the problem from "an industry-wide agent habit" to "a specific Claude Code behavior", which also gives it a clear owner to fix.

Finally, a reality check: in the Shai-Hulud worm incident of September 2025, malware ran the TruffleHog secret scanner in bulk over victims' machines, and that same scanner flags more than half of these 1,122 files. In other words, these keys are not "theoretically findable" — they have already been swept by a tool used in bulk harvesting. The researchers tested no credentials to see whether they still work — except one company they notified, which confirmed its key had been live — but "not tested" and "never used" are two different things, and readers should not confuse them.

5. This was reported back in August 2025

If anything in the research is surprising, it is not the numbers but the timeline. On August 11, 2025, a user reported in a GitHub issue that approved commands with API keys and tokens were being stored word for word in settings.local.json. After 60 days without activity, the report was closed as "not planned" on January 3, 2026. According to The Hacker News, the four related reports the researchers cite have all now been closed by the same bot, the most recent the day after the research was published, November 6 — and none received a reply from Anthropic.

The technical fix is easy: strip keys before saving an allow rule, write the file into the project's own .gitignore, or warn the user when a command being approved contains a key. The hard part is priority. Fifteen months, four reports, zero replies — the issue simply never made it up the queue inside Anthropic, until someone counted it: 2,539. Many security problems live this life: not unknown, just judged to be "a small opening", until someone measures how big it actually is.

The study's limits should be stated just as clearly, because they bear on how much the numbers can be trusted. First, Apiiro sells security products for coding agents, so it has a commercial stake in this topic, and its numbers have had no independent replication. Second, except for the one company that confirmed its key was live, the researchers tested no credentials, so how many still work is unknown. Third, the total of 2,539 rests in part on an AI reviewer's judgment rather than manual verification of every item. These limits come from cross-checking several secondary reports, and this article flags them as such — stating the limits is what makes the numbers credible; hiding them is what would invite doubt about the numbers themselves.

6. Check now: rotate first, clean up second

The researchers' checklist for developers is specific, and the order matters: rotate first, clean up second. First, search your whole GitHub organization for .claude/settings.local.json and .claude/settings.json, including git history — even where the files are gone today. Second, rotate every password, token, and key the files have ever held, and only then clean up the files. Reversing the order wastes the effort: delete the file first and the key still sits in history and in forks, so nothing was done. Third, stop tracking the local file with git rm --cached .claude/settings.local.json, and add it to the repository's own .gitignore. Fourth, open the file on your own computer and delete every rule that contains a secret — even if it was never committed. Fifth, keep secrets out of commands from now on: 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. Sixth, approve patterns, such as Bash(npm run:*), instead of single commands, so no specific content ends up in a rule at all.

The checklist for security teams is different: treat agent folders such as .claude/, .cursor/, .gemini/, and .specstory/, and agent memory files, as holding secrets, like .env files — on laptops as well as in repositories. Add them to pre-commit and CI secret scanning, including git history, and make sure the scanner catches passwords inside commands, not only known key formats. Add .claude/settings.local.json to the organization's .gitignore templates. And check credentials paired with a public server first, because those are the ones that give access.

One last word specifically for people who vibe code. The vibe coding workflow is to keep telling the agent things: the database will not connect, so you paste it the connection string; the API call fails, so you paste it the token; the deploy breaks, so you paste it the key. The agent takes it all, and when you click "don't ask again", it writes those things into a file along with the command. You think you are having a conversation; you are actually writing a configuration file that will be committed. It used to take a mistake to leak a key; now normal work is enough — one click on "don't ask again" will do it. Two habits block most of the risk, and neither costs money, only three seconds: keep keys in environment variables and secret managers, never on a command line; and before every click on "don't ask again", glance at the command for anything you would not want published.

In one sentence: vibe coding turned "writing code" into "talking", and the price of talking is that a password you mention in passing is written down word for word, saved in a file, and carried along with the code. It used to take a mistake to leak a key; now it takes one click on "don't ask again". The button itself is not wrong — what is wrong is that it remembers far more than you thought, and your repositories, your forks, and your git history are remembering it for you.

Views 5Comments 0

Comments (0)

ME
0/1000
Loading comments...

Sources

Browse projectsPublish your project

Related articles

A developer with glasses types on a laptop at a wooden desk, an external monitor to the left showing C code on a dark background, a small plant on the desk
News
Microsoft's Coding Model Stops Playing Second Fiddle: MAI Code 2 Scores 96% of Opus 5.5 for 5% of the Cost — Read the Three Caveats First

On 17 November 2026, Microsoft launched MAI Code 2 and Code 2 Flash: the larger model has 77 billion active parameters and a one-million-token context, averaging 63.2% across four benchmarks — close to GPT-6.1 Sol and Claude Opus 5.5 — at $0.309 per task. Read the three caveats first: promotional pricing, the lowest score of the three, and no long-horizon work.

Developer WorkflowProduct LaunchModel Updates
A developer types at a dual-monitor workstation; the left screen shows a dark code editor, the right a testing dashboard with green checkmarks and bar charts
News
Did Your Agent Get Better or Worse? AWS Open-Sources UAEF to Measure Agents from Every Framework with One Ruler

On 11 November 2026, AWS open-sourced UAEF: adapters turn traces from LangGraph, LangChain, Strands and Bedrock AgentCore into one format, then 36 metrics across 7 dimensions score them, flagging regressions past 5%. The judge model is hardened too — scores must cite verbatim evidence, and never decide safety.

Developer WorkflowProduct LaunchTesting & Quality
Against a black background, a conductor seen from behind raises a baton, with swirling trails of light circling beneath him like an orchestra being conducted
News
One API for 45 Models, and It Switches Providers When One Fails: Perplexity's Orchestrator Wants to Be the Switchboard

On 17 November 2026, Perplexity launched the Orchestrator API: one interface reaching OpenAI, Anthropic, Google, xAI and open-weight models such as GLM, Kimi and DeepSeek, billed at the answering model's published rate with no platform fee. When one provider fails, the same model retries on another deployment, and preview routing assigns requests to models by task.

Developer WorkflowProduct LaunchModel Updates