AI-Native Methodology

Claude Code Permissions Can Leak Secrets and Switch Off Your Checks

Bill Cava/

Everyone who has used Claude Code, Anthropic's coding agent, has seen the prompt. It asks before running a shell command, and one of the answers is "Yes, and don't ask again."

Apiiro, a software security company, went looking for what that answer leaves behind. It found 104,185 public copies of the settings file where those approvals land, and 1,122 of them held at least one password, token or key.[1]

The usual reading is that people committed a file they shouldn't have. That's true, and it misses the larger point. Every approval, plugin install and mode switch is a write to your coding agent's own settings, and those settings decide two things: what leaks, and which of your checks still run.

What does "don't ask again" actually save?

It saves an allow rule in a settings file inside the project, so matching commands run without asking in later sessions. Sometimes the rule is a pattern, such as npm test *. Sometimes it's the exact command, and then any password typed into that command is saved too, in plain text.[1]

The Claude Code permission prompt for a shell command, npm test, offering four answers: Yes; Yes, and don't ask again for: npm test *; Yes, and switch to auto mode; and No.
Answer two is a write to a file in your project, and here it saves a pattern. Source: Claude Code permissions documentation.

Claude Code tries to keep that file out of git. The first time it writes the file, it adds it to the user's global git excludes, a setting that lives on one person's computer.[2] That protection doesn't travel with the project, and it does nothing for a copy someone already committed.[1]

The numbers from Apiiro's write-up, as reported by The Hacker News:[1]

  • In 539 of 1,105 traced repositories, a commit listing Claude as a co-author changed the file.
  • Counting older versions, the shared project file and saved chat logs, the total is 2,539 secrets across 1,994 repositories.
  • Of 16 coding agents compared, Claude Code is the only one confirmed to save the full approved command in a project file by default.

Apiiro didn't test whether the secrets still work. One company it notified confirmed its key had been live.

Where are Claude Code permissions stored?

Claude Code reads permissions from settings files at several levels: your own user file, a shared project file teams commit on purpose, a project-local file meant to stay on one machine, and managed settings an administrator sets for the organization. "Don't ask again" approvals land in the project-local file.[2]

That layout is sensible, and it's also four places your agent's behavior is configured. Most teams review the shared file in pull requests. Almost nobody reads the local one, because nobody wrote it by hand.

What does the Claude Code team say?

The Claude Code team answered the same day on Hacker News. The reply makes three points, each of them good advice, and adds that the team is looking into what it can do to prevent this.

Boris from the Claude Code team, replying to Apiiro's finding
Boris Cherny · November 7, 2026

.claude/settings.local.json is meant to stay local. This is not a file you should check into source control. We automatically gitignore it when Claude creates the file, so in this case the files were manually created and checked in … Permission rules are old hat. Everyone should be using auto mode instead … Regardless of what agent you use, you should have secret scanning enabled.

Source: news.ycombinator.com. Reproduced verbatim; punctuation is the source's.

Auto mode hands approvals to a classifier instead of a hand-kept list, and we've looked at what auto mode actually reviews. All three answers treat the settings file as the user's problem to keep tidy.

Goldman Sachs reached for a different answer. Internal guidance updated in October restricts Claude Code and GitHub's coding tools to the bank's engineers, after a review of productivity and risk.[4]

Narrowing who runs the agent is a reasonable call for a bank, and it doesn't change what the agent writes. The leaked files in Apiiro's study sat in software repositories, where engineers already work.

Can a plugin change your agent's settings without asking?

Yes, and Postman's desktop app did it to two coding agents. In an October 25 GitHub issue, a Postman user showed that the Postman desktop app had installed its own plugin into Claude Code and Codex, OpenAI's coding agent, and recorded its startup hook as trusted in Codex's config.[5]

A section of GitHub issue 14370 headed Codex's global user configuration was changed, showing the config file with a Postman marketplace entry, the postman plugin set to enabled = true, and a session_start hook with a trusted_hash value.
Nobody typed these lines, and the agent read them as a decision the user had made. Source: postmanlabs/postman-app-support issue 14370.

The hook told the agent to route API work through Postman. The reporter called automatically changing unrelated coding agents and approving your own hook "a severe consent and trust-boundary problem." Postman reverted the change on November 5 and said it would redesign the experience "with the right level of control."[5]

This is about to get bigger. DeepSeek says about 35,000 third-party plugins already run on its Harness agent app, roughly 60% of active users have created or installed one, and an official marketplace is coming.[6] Plugins and saved approvals are now a large part of what a coding agent is.

Can a routine operation switch off a policy check?

In a controlled study, yes. Four researchers at CSIRO, Adelaide University and UNSW installed policy and approval plugins in five released agent harnesses, the software that wraps a model with tools and permissions. They then ran ordinary operations those harnesses support, and in two cases a prohibited edit ran while every plugin reported healthy.[7]

Figure 1 from the paper, two panels. Panel (a), DeepSeek Harness: with policy arranged first, an edit reaches the policy plugin; after the switch from observe to enforce mode, the approval plugin ends the chain, the operator approves, and the prohibited edit executes with policy not reached. Panel (b), OpenCode: with no saved allow rule the reviewer evaluates and policy denies the edit; after an earlier always reply saved a rule, the reviewer abstains and the prohibited edit executes with no policy request.
Same plugins, same final settings, and the outcome depended on what happened earlier in the session. Source: Xia, Lu, Sejdinovic and Zhu, Figure 1.

The mode switch. On developer previews of DeepSeek Harness, switching the policy plugin from observe to enforce mode, a documented step, moved it behind the approval plugin in the queue of checks. From then on it saw no edits. Five live models made 28 reads and 28 edits, and the policy evaluated every read and none of the edits.[7]

No captured component check reported the loss: both providers stayed active, the policy plugin still blocked a read in enforce mode and the plugin manager raised no warning.

Xia, Lu, Sejdinovic and Zhu, When Routine Operations Break Architectural Pattern Relationships in LLM Agent Harnesses, 2026

The saved approval. The second case is the same click Apiiro studied, measured from the other side. On OpenCode, an open-source coding agent, one "always" reply saved an allow rule, and the next prohibited edit ran without a policy review.

The reviewer plugin only looks at requests that still need approval, and that edit no longer did. Two control runs that answered "once" had every later edit reviewed.[7]

A permanent approval changes which later checks happen. That's why approval is architecture, not vigilance: the click you make once decides what gets looked at from then on.

Why didn't the tests catch it?

Because the tests checked the work, not the path it took. The researchers asked live models to build a feature across the mode switch, with all 390 of the project's existing tests required to pass.

The work passed with the policy in the path and with it out, and the policy saw none of the 19 covered attempts in the broken arrangement.[7]

A green test suite and a healthy plugin list told the team nothing about whether the check ran. Only joining each edit to its policy record exposed the gap, which is the same lesson as evidence from outside the agent.

The Claude Code case went the other way: Anthropic's hook plugin kept checking after a saved allow rule.[7]

What the study can't tell us

The authors chose their cases to show that these failures happen, not how often. The main harness was a developer preview, the operator replies were programmed, and only one Claude Code plugin was tested, and it held. We read it as a direction: approvals and plugins are stored state, and stored state can remove a check without anyone seeing.

How do you check your coding agent's permissions this week?

Treat your agent's settings the way you treat any other configuration: read what got written, and test that the checks still run after the operations you actually use. Seven checks:

  1. Open the shared and local settings files in every project, and delete any rule that holds a secret.
  2. Rotate anything that ever appeared in them, including in git history, before you clean up.
  3. Add the local file to each project's own ignore list, not only your machine's.
  4. Approve patterns or variables, never literal commands with a secret inside them.
  5. Turn on secret scanning wherever your code is hosted.
  6. List the plugins and hooks each agent loads, and remove any nobody installed on purpose.
  7. After a mode change, a plugin install or a permanent approval, try one prohibited action on purpose and confirm it gets stopped.

The trust boundary is designed, not assumed, and these settings files sit inside it. Whether you commit the local file or not, it is part of how your software gets built.

References

Frequently asked

What is the Claude Code "don't ask again" secrets leak?
›When you approve a shell command with "Yes, and don't ask again," Claude Code can save an allow rule holding that exact command in a settings file inside the project.
⌄When you approve a shell command with "Yes, and don't ask again," Claude Code can save an allow rule holding that exact command in a settings file inside the project. Any password or token typed into the command is saved with it, in plain text. The security firm Apiiro found more than a thousand public GitHub copies of that file holding a secret.
Where are Claude Code permissions stored?
›In settings files at several levels: your own user settings in your home folder, a shared project file that teams commit on purpose, a project-local file meant to stay on one machine, and managed settings an administrator sets for the whole organization.
⌄In settings files at several levels: your own user settings in your home folder, a shared project file that teams commit on purpose, a project-local file meant to stay on one machine, and managed settings an administrator sets for the whole organization. Approvals you give with "don't ask again" land in the project-local file.
How do I check my Claude Code permissions for leaked secrets?
›Open the shared and local settings files in each project and read every allow rule.
⌄Open the shared and local settings files in each project and read every allow rule. Search your GitHub organization and each repository's history for both files, even where they were deleted. Rotate any password, token or key that ever appeared in them before cleaning up, add the local file to the project's own ignore list, and turn on secret scanning.
Is auto mode safer than approving commands one by one?
›The Claude Code team recommends auto mode over hand-kept allow lists, and it avoids saving literal commands.
⌄The Claude Code team recommends auto mode over hand-kept allow lists, and it avoids saving literal commands. It is still a setting the harness holds for you. Whatever approval model you use, check what it writes to disk and confirm your policy checks still run after you change modes, install a plugin or approve something permanently.
Does restricting coding agents to engineers fix the risk?
›It narrows who uses them, which is a reasonable call for a bank.
⌄It narrows who uses them, which is a reasonable call for a bank. It does not change what the harness writes or which checks it skips. The leaked settings files in Apiiro's study sat in software repositories, and many were changed in commits that listed Claude as a co-author.
Work with us

Let’s build it together.

We turn clever prototypes into production systems people can rely on. If you’re building with agents and want a hand making it real, leave your email and we’ll be in touch.

Straight to the team. No spam.