DEV Community

Cover image for Claude security: your secrets in a settings file, and an extension that runs code
Adil Ben Moussa
Adil Ben Moussa

Posted on Originally published at tt-tech.io

Claude security: your secrets in a settings file, and an extension that runs code

First published on tt-tech.io.

Three security stories about Claude in one week, and none of them is a classic hack. Nobody broke an encryption or stole a password database. In each story the agent did what it was allowed to do. The problem sat in the approval: one saved forever, one clicked by a script, one never asked.

1. "Don't ask again" saved your secret

When Claude Code asks to run a shell command, one answer is "Yes, and don't ask again". Claude Code then writes a permission rule into .claude/settings.local.json in your project. The rule can hold the command word for word. If the command had a token or a password in it, the file now has it too. Claude Code adds the file to your global git excludes, but that protects one machine only: your project's .gitignore does not list it, so a clone, a copy or a file made by hand can still be committed. [1]

How one click puts a secret on GitHub. Step 1: Claude asks to run a curl command with a bearer token in it, and you pick "Yes, and don't ask again". Step 2: the command is saved word for word as an allow rule in .claude/settings.local.json, token included. Step 3: git add and git push take the file, because the project's .gitignore does not list it, and the token is readable in a public repo. Claude Code's global git exclude only covers your own machine, and deleting the file later does not clean git history: rotate the token

Apiiro, a security company, went looking on public GitHub. Of 104,185 public copies of that file, 1,122 held a real secret, 1,379 distinct secrets in total. Add git history, the shared settings.json and agent transcripts, and they count 2,539 secrets in 1,994 public repositories. [1]

What Apiiro found on public GitHub. Of 104,185 public settings files, 1,122 held a real secret, 1,379 distinct secrets; counting git history, the shared settings.json and transcripts, 2,539 secrets in 1,994 repositories. Of the 1,122 files, TruffleHog caught 643 (57%), gitleaks 564 (50%), and neither caught 215 (19%), about one file in five

The number that stays with me is a different one. Two common secret scanners, TruffleHog and gitleaks, both missed the secret in 215 of those 1,122 files, about one in five. Apiiro did not test whether the secrets still work, although one affected organisation confirmed its key was live. A Claude Code team member replied that the leaked files were created by hand, not by the agent. Either way, the file ended up in Git.

An approval you save is a line of config. Treat it like code, because Git does.

2. A browser extension that drives Claude on your desktop

The second story comes from Forever Security, who call it ThisBash. Claude Dispatch lets you send a task from claude.ai to Claude Desktop on your computer. Their proof of concept is a browser extension that may run scripts on claude.ai. It opens a small popup in the background, finds your paired desktop session, sends Claude four prompts, and clicks "Allow" on every approval by itself. In their demo Claude installs an npm package whose install script opens the Calculator. You do nothing. [2]

ThisBash, from a browser extension to your machine. Condition: a malicious extension is already installed and may run scripts on claude.ai, and Claude Desktop is paired with Dispatch. Step 1: the extension uses your signed-in claude.ai session. Step 2: a small popup opens in the background and finds your paired desktop session. Step 3: four prompts are sent to Claude and a script clicks Allow. Step 4: Claude installs an npm package and its install script runs on your computer. A confirm button only proves consent if a person clicks it

Read the condition before you panic: a malicious extension must already be installed and allowed on claude.ai. Per the researchers, they reported it on 14 May, Anthropic called it valid but already known internally, and on 13 October said it was targeting the end of October to retire Dispatch. Reports since say Dispatch is closed to new users but still running for existing ones. Anthropic has not commented publicly, so treat the timeline as the researchers'.

The lesson is bigger than Dispatch. A confirmation button only proves consent if a person clicks it. In a page that an extension controls, nothing tells you who clicked.

3. Your email in a header

The third one I wrote about on Friday: Claude Code put the signed-in account email in the User-Agent of requests to other sites. The full story, the fix in 2.1.317 and what it does not cover are in Claude Code leaked your email.

One weak spot

Put the three next to each other and they are the same story. The model did not break. The approval did: a yes that became config forever, a yes that a script gave for you, and a question nobody asked.

Three stories, one weak spot: the approval. Saved forever: "don't ask again" turned a one-time yes into config with a token in a file Git can take; do: ignore the file, rotate what it held, keep secrets in env variables. Clicked by a script: a browser extension pressed Allow and Claude ran a package; do: remove unused extensions and turn off remote features you do not need. Never asked: Claude Code put your email in headers to other websites; do: update to 2.1.317 or later and give the agent a team contact. Treat an approval like code. Git does

What to check right now

  • Find the file. In every repository run git ls-files | grep settings.local.json. If it shows up, run git rm --cached .claude/settings.local.json and add .claude/settings.local.json to .gitignore.
  • Rotate what it ever held. Removing the file does not clean git history, forks or clones. Check with git log --all -p -- .claude/settings.local.json, and rotate every key you find there.
  • Keep secrets out of commands. Let the agent read them from an environment variable. Approve patterns like Bash(npm run test *), not one command with a token inside. One line in AGENTS.md covers it: never write a secret value into a command.
  • Review your browser extensions. Remove the ones you do not use, and look hard at any that may "read and change data on all sites". Work in a browser profile with only the extensions you need.
  • Turn off what you do not use. Remote and cross-device features like Dispatch belong on the list of things the team switches on deliberately, not by default.
  • Check the version. claude --version on every machine, 2.1.317 or later, for the partial email fix.

The first two checks, as commands you can paste in each repository:

# 1. Is the file tracked?
git ls-files | grep settings.local.json

# 2. Stop tracking it and ignore it from now on
git rm --cached .claude/settings.local.json
echo ".claude/settings.local.json" >> .gitignore

# 3. Everything it ever held, in every branch: rotate what you find
git log --all -p -- .claude/settings.local.json

# 4. Claude Code version on this machine
claude --version
Enter fullscreen mode Exit fullscreen mode

None of this needs a security team. It needs fifteen minutes and someone who owns it.

Sources

  1. Apiiro, Coding Agents Are Leaking Your Secrets to GitHub, 5 November 2026
  2. Gal Weizman, Forever Security, ThisBash Escape: Claude Dispatch Flaw Enables Browser Extensions RCE on the OS, 4 November 2026

First published on tt-tech.io, also in French and Arabic.

Top comments (10)

Collapse
 
annavi11arrea1 profile image
Anna Villarreal •

Useful! ✨️ I should check this.

Collapse
 
adilbenmoussa profile image
Adil Ben Moussa •

Thanks Anna. Two commands and you know where you stand: git ls-files | grep settings.local.json in each repo, and git log --all -p -- .claude/settings.local.json for anything it ever held. If the second one shows a token, rotate it, removing the file is not enough.

Collapse
 
bloqarl profile image
Carlos | Zealynx •

In a Foundry repo the worst thing that lands in that file is a deployer key: forge script ... --private-key 0x... approved once with "don't ask again", saved word for word. Rotating it isn't like rotating an API token either. The key is the address, so it means a new deployer, then moving every owner role, allowlist entry and balance to it. The pattern advice has a catch there too: Bash(forge script *) also approves the same script with --broadcast on mainnet. A keystore (cast wallet import deployer --interactive, then --account deployer) keeps the key out of the command, so there's nothing to save.

Collapse
 
adilbenmoussa profile image
Adil Ben Moussa • • Edited

Carlos, that is the worst version of the story: the key is the identity, so rotation means moving the whole deployment. The keystore is the right fix, nothing in the command means nothing to save. And the wildcard trap is wider than Foundry: Bash(forge script *) is approved forever with any argument. I would add an ask rule for the dangerous one, Bash(* --broadcast*); ask wins over allow, so the deploy still prompts every time.

Collapse
 
bloqarl profile image
Carlos | Zealynx •

That ask rule only sees the command line the agent types, though. cast send signs and sends with no --broadcast in it, and a make deploy or ./deploy.sh that runs forge script --broadcast inside won't match either. I'd put the ask on cast send and on whatever wraps the deploy scripts too.

Thread Thread
 
adilbenmoussa profile image
Adil Ben Moussa •

Fair point, the ask rule only sees text. Put the line on the network instead: turn on the Claude Code sandbox and leave the mainnet RPC host out of sandbox.network.allowedDomains. That covers every process the agent starts, so no wrapper reaches mainnet.

Thread Thread
 
bloqarl profile image
Carlos | Zealynx •

Yup, that's the better layer, it doesn't care how the command is spelled. I'd also set allowUnsandboxedCommands to false. Otherwise a command that fails in the sandbox can be retried outside it, and in bypassPermissions that retry doesn't even ask. And the proxy only checks the hostname, so with a provider that serves mainnet and testnet from one host, like rpc.ankr.com/eth and rpc.ankr.com/eth_sepolia, there's no host to leave out.

Thread Thread
 
adilbenmoussa profile image
Adil Ben Moussa •

Thanks Carlos, both are fair. allowUnsandboxedCommands: false belongs in the same settings file, and the hostname limit means the RPC provider is part of the setup: pick one with a hostname per network.

Collapse
 
litalkumiq profile image
Lital Shalev •

The global Git exclude detail is easy to miss: it protects one checkout, not a repository shared with the team. I also liked the point that a saved approval is just config after that. It makes reviewing local agent settings feel much closer to reviewing credentials and CI permissions.

Collapse
 
adilbenmoussa profile image
Adil Ben Moussa •

Exactly. The exclude Claude Code writes is in your global git ignore, so it covers every repo on your machine and nobody else's clone. A teammate who creates the file by hand commits it without a warning, which is why the article puts it in the repo's .gitignore too. And yes, a saved approval is config: the dangerous commands go in the shared settings.json as deny or ask rules, so nobody can approve them away locally.