Don't Ask Again Saved API Keys in Public Repos

Claude Code saved approved commands and their secrets in settings.local.json. Apiiro found 1,122 public copies with secrets. Version 2.1.323 leaves them.

By Muhammad Saif and Aashan Khan · Techtribe co-founders

"Yes, and don't ask again" is the button a developer hits so Claude Code will stop prompting for a command they expect to run all afternoon. Anthropic's client then writes an allow rule. When the rule is the exact command, the file stores that command in plain text, and a token inside the command is stored with it. The file is .claude/settings.local.json, inside the project.

Apiiro researchers Shmulik Cohen and Matan Giladi showed how often that file is public. Their count, reported widely on November 7 and 8, 2026 and covered by The Hacker News, was 1,122 public copies holding at least one secret. One company they notified confirmed a key was still live. The file is a local convenience that became a credential store, and the credential store was committed.

Claude Code 2.1.323, released November 12, changes the button for some new rules. It does not walk GitHub and it does not expire a key. If you need the rotation order, use the incident guide for keys an agent already exposed. This note is the setting: what it writes, why the git protection did not travel, what 2.1.323 changed, and how to search an organization before you assume you are in the clear.

Auto mode, the classifier that sits in front of tool calls, is a different control and a different release. That one is in what changed for Claude Code auto mode in CI. Do not mix them up when you brief a team. One decides whether a call is reviewed by a model. The other decides whether an approved command is written to disk forever.

What the button writes

By default Claude Code asks before it runs most shell commands. The "don't ask again" choice saves an allow rule so a later session can match that command and run it. Apiiro's account, and the product behavior they reproduced, says the saved rule is sometimes a pattern such as a test command with a wildcard, and sometimes one exact command. Exact commands are where passwords and tokens live. The researchers reproduced the behavior with current models at the time, including Opus 5.5 and Fable 5.1. This was not a leftover from an old build that nobody runs.

The file sits in the project because the rule is about that project. That is convenient for the developer and convenient for git add. Claude Code's mitigation is a global git exclude, added the first time the file is written in a repository, so git on that computer ignores the path in every repo. Boris Cherny, on the Claude Code team, said on Hacker News that the file is meant to stay local and that Claude Code gitignores it when it creates it. Apiiro's data is what happened anyway.

The exclude is per user and per computer. A second laptop, a CI runner, a teammate who clones the repo, or a file that was committed before the exclude existed all sit outside that protection. Apiiro says the product does not add .claude/settings.local.json to the repository's own .gitignore, so the protection does not travel with the project. Anyone who commits the file, including the agent, publishes the rules.

The co-author signal is the awkward part. In 539 of 1,105 repositories Apiiro traced, a commit that changed the file listed Claude as a co-author. The researchers read that as Claude often committing the file itself. A developer who would never run git add on a secrets file still ends up with the commit, because the agent that just gained an allow rule is the same agent they asked to "commit the setup." Reviewing agent co-authored diffs is not a courtesy. It is how this file gets caught on the day it appears.

The shared file is a related door. .claude/settings.json is the one teams commit on purpose, for hooks and project permissions. Apiiro found secrets in 298 of 76,011 public copies, mostly inside allow rules. A project rule that includes a token is a decision someone made, or an agent made and a person merged. It belongs in the same search. Ignore it and you will clean the local file and leave the shared one on the default branch.

What the public copies contained

Apiiro reported 104,185 copies of settings.local.json in 103,617 repositories. The 1,122 copies with at least one secret held 1,379 distinct secrets, about 1.1 percent of the files. A value counted when it matched a known key format, or when a password or token sat next to a public server address, and an AI reviewer agreed. Apiiro did not claim those secrets had been used, and it did not test them. The Hacker News account says one notified company confirmed its key was still live. Treat "not tested" as "not safe."

The mix is what a shell session looks like. More than a third of the secrets opened a database directly, including 379 database passwords. Apiiro's public totals also include 43 SSH logins for public servers, 42 tokens for GitHub, GitLab, and npm, and 23 AWS keys. Sixty-three organizations, mostly software companies, were among the owners. The cases Apiiro called out as strongest included a database vendor's admin-level cloud key and the owner password of a medical-records database. Those are not toy keys from a tutorial. They are the keys a coding agent sees when a real company asks it to debug a connection.

Time made the leak worse. As of the Monday in Apiiro's write-up, every file with a secret was still on the default branch, and in half of the repositories it had been there at least 217 days. A secret that sits for most of a year is a secret that has been cloned by employees, by CI, by forks, and by anyone scanning public GitHub. Finding it "today" does not mean it appeared today.

Deleting the file had already failed a large set of people. Apiiro found 734 additional secrets in older versions across 509 repositories, usually because the current file was gone. Forks extended the window: 211 forks of 74 repositories carried the same secrets as the originals. Including history, the shared settings file, and saved agent chat logs, the researchers' wider total was 2,539 secrets across 1,994 repositories.

GitGuardian's November 9 count is the one to read next to these figures, because it includes what was pushed and later destroyed, and because it checked validity. They reported 31,088 distinct secrets in settings.local.json and 5,343 valid at detection. The two reports are compared in the incident guide. Use Apiiro's count to see how many current public files a code search can still open. Use GitGuardian's count to see how often the string was a working credential. Then rotate anything your own search finds, without waiting to reconcile the methodologies.

What version 2.1.323 changed, and what it left on disk

The November 12 changelog line is small. "Don't ask again" now keeps an allow rule for the current session only, and does not write it, when the rule looks like it holds a secret, or when saving it would write to a settings.local.json that git already tracks. A careful reading of the client, published by sysnote the same week, describes two checks on the tool name plus the rule text.

The first check reuses Claude Code's existing secret scanner, the one that already knew how to recognize credentials for redaction and had not been applied to the rule being saved. It looks for known key formats and for a user-and-password pair inside a URL. The second check is a list of patterns aimed at the way people type passwords into commands: variable assignments whose names look like passwords, tokens, or API keys, the same names as flags and headers, and a set of common client invocations that take a password inline. A value that is only a variable reference is allowed to be saved, which is what you want. A rule that says "use $PGPASS" is a name. A rule that includes the password is a secret. If the scan throws, the rule stays session-only as well.

The git half of the change asks git whether settings.local.json is already tracked and refuses to add a standing rule to a tracked file. The same release extends the global exclude so it is also added when a folder becomes a git repository later, or on a new machine, which covers the gap where the protection existed only on the computer that first wrote the file. A committed settings.local.json is no longer treated as the user's own settings when Claude Code starts in certain subfolders.

Read the limits in the same sitting. The check skips a rule that is already present in the destination file. Nothing in 2.1.323 scans the file you already have and deletes the bad lines. Public GitHub is untouched. Forks are untouched. Images that copied the file are untouched. A secret written as an unusual string that matches neither the token scanner nor the password-shaped patterns can still be saved. Upgrade every laptop and every CI image that runs Claude Code. Then assume the files created before November 12 are still full of whatever they were full of yesterday.

GitLab's write-up of the leak says the same thing in operational language: find the first commit that contained the file, and rotate before you touch the file. Deleting the path from the working tree leaves the value in history and in every fork until the credential is changed. The product fix is a seatbelt for the next click. The old click is an incident.

How to search without making it worse

Search from a browser or from git, not from an agent session that will approve more commands while you investigate.

  1. On GitHub, search the organization for the path .claude/settings.local.json and for .claude/settings.json. Start with the default branch. Then search code across forks you own. A hit is a rotation, not a debate.
  2. On each developer machine, look for the file in active repos and in the global Claude settings. A file that was never pushed can still hold a production key the developer approved last week. That key is exposed to anyone who can read the laptop, and to any later commit that adds the file.
  3. For every hit, copy the key prefix and the provider into a list. Do not paste the full secret into Slack, into a ticket, or into another coding agent. The list is how you revoke. The full secret is how you leak it a second time.
  4. Identify the first commit that introduced the file, and the date. That date starts the log review at the provider. Half of Apiiro's repos had carried the file for at least 217 days. Your "first commit" may be older than the employee who found it.
  5. Upgrade Claude Code to at least 2.1.323 on laptops and in CI images. Confirm the version with the client, not with a Dockerfile comment. A base image that pins an older CLI will keep writing rules the new laptop no longer writes.
  6. Add the local settings path to the repository .gitignore and, if you build containers from that directory, to .dockerignore. The project file is the protection that travels. The global exclude is the protection that did not.
  7. Rotate every credential the files ever held, including values that only exist in history. Then remove the files from branches you still ship. The sequence and the places copies hide are in the rotation guide.

If the organization search is noisy, prioritize rules that contain :// with an embedded password, cloud key prefixes, and database URLs. Those are the families both research teams found in volume. A noisy search is still a search you finish. An unread CSV of hits is the same as not looking.

Tell people what the button does, in one sentence, in the channel they already read. "Don't ask again writes the command into the repo folder" would have prevented a share of these files. The sentence belongs in onboarding for anyone who installs Claude Code, next to the request to keep production passwords out of shell history. A policy wiki nobody opens will not compete with a button labeled as convenience.

What does not hold

Upgrading and moving on does not hold. 2.1.323 leaves existing rules in place. A team that upgrades on Friday and never searches is a team whose Monday clone still has the key.

A global git exclude on the security lead's laptop does not hold for the rest of the company. Each machine needs the client behavior, and each repo needs the project gitignore. New hires image a laptop from a setup script. Put the version pin and the gitignore in that script.

Force-pushing the default branch to erase the file does not hold while the key works, and it does not hold for forks. It can also destroy other history you needed. Revoke first. Rewrite history only if you still have a reason after the key is dead, and expect forks to keep the old object.

Assuming private repositories are out of scope does not hold. The research is public because public GitHub is what the researchers could see. A private repo with the same file has exposed the key to everyone with clone permission and to every CI job that checked the repo out. Search private orgs with the same path. The absence of a researcher email is not an absence of the file.

Treating the shared settings.json as safe because it is "supposed" to be committed does not hold. Apiiro's 298 copies with secrets are supposed-to-be-committed files. Allow rules in the shared file need the same review as a workflow. A token in a shared rule is a token you meant to publish, or an agent published for you. Both get rotated.

Blaming the model for remembering a command does not hold as the fix. The model proposed a curl the task required. The product stored the approval. The durable control is a command that references a secret by name, a file the repository ignores, and a key that was never in the command string. People will keep clicking the button. Make the click safe.

What a safe approval looks like after the upgrade

The command the agent proposes uses an environment variable or a secret-store lookup. The allow rule, if it is saved, contains the variable name. The value is set in the environment for that session, from a store the editor does not commit. Production values are not in that environment at all when the task can be done against staging.

Hooks and permissions in the shared settings file are reviewed in pull requests. An agent co-author is a flag for a human to read the diff, which the 539 co-authored commits make concrete. The human checks for strings that look like credentials and for commands they would not want to run silently next week.

CI uses a pinned Claude Code version at or past 2.1.323, with a token that can do the CI job and cannot create new cloud keys. A headless run that needs a secret reads it from the CI secret store at runtime. It does not echo the command in a log. If the job fails closed because a newer safety check refuses a call, that failure is preferable to a green job that wrote a key into an artifact. The auto-mode behavior of headless runs is the other note. Read it when you pin the version, so you know which failures are the safety check and which are the secret scanner.

Once a quarter, rerun the path search. The button will remain tempting, the patterns in the scanner will miss something, and a new tool will invent a new filename. A calendar reminder is the whole control. It works if the person who owns it can see the org search. Give them that access before you need the incident channel.

If a customer or a researcher writes to you about a specific key, respond as if the key is live, because Apiiro's notified company found that it was. Rotate, then explain. A reply that asks the researcher to delete their copy, while your key still works, is a request for them to do your incident response. They will not. You will.

If this is your app, send the repo.

A 30-minute scope call. We read what is live, name what is dangerous, and quote a fixed scope.

How Techtribe audits the setting across a team

We search the repositories and the settings files you point us at, separate the rules that contain live-looking credentials from the rules that are only command patterns, and hand you a rotation list keyed by provider. We also pin what "upgraded" means: which version is on laptops, which version is in CI, and whether the project gitignore is actually on the default branch. You leave the call with the order of operations, not with a generic warning about AI tools.

A one-time audit fits when you have just seen the filename in a repo you own. A Dedicated Team fits when every engineer runs an agent and the settings keep coming back. If the keys are already public, the sweep in the exposure guide is the first day, and this audit is how you stop the next file.

Bring an org search for .claude/settings.local.json, or access for us to run it with you, and the Claude Code version your setup script installs. If you do not know the version, that is the first finding. We would rather spend the thirty minutes on the files you have than on a version you hope you installed in March.

The fixed scope for taking a generated app to production is a page per tool: Lovable, Bolt, v0, and Replit.

Questions

What does Claude Code's "don't ask again" choice store?

When a person picks "Yes, and don't ask again," Claude Code can save an allow rule for that command in .claude/settings.local.json. If the rule is the exact command, a password or API key typed into the command is saved in plain text. Later sessions can run the matching command without asking.

How many public repositories did Apiiro find?

Apiiro reported 104,185 copies of the file across 103,617 public repositories. About 1.1 percent, 1,122 copies, held at least one secret, 1,379 secrets in total. The researchers did not test whether the secrets still worked. GitGuardian, counting history and checking validity, reported a larger set. Both point at the same file.

Does Claude Code 2.1.323 fix repositories that already leaked?

No. The November 12, 2026 change keeps a new allow rule session-only when it looks like a secret, or when the settings file is already tracked by git. Rules already on disk are left in place. Upgrade so the next approval is safer, then rotate anything the old file ever held.

Why did a git exclude not stop the commits?

Claude Code adds the file to the user's global git excludes on the computer where it first writes the file. That setting does not travel with the repository, and it does nothing if the file was already tracked. Apiiro says Claude Code does not add the path to the project's own .gitignore.

Book a free call

Have a vibe-coded app in production?

30-minute free call. We'll read what you have, name what is dangerous, and quote a fixed scope.