← AI Coding

Claude Code sometimes put account emails in User-Agent headers: how it happened and what to lock down

The top coding story on Hacker News this week is a privacy bug in Claude Code: the model had your account email in context and sometimes used it as a contact address in requests to outside sites. Anthropic has added a check and says the email is leaving the context. Here is the mechanism, the gaps, and the settings that hold.

HOW THE ADDRESS LEFT THE MACHINEcontexttool callUA: name + emailread in docsrefuses a matchSigned-in accountemail in model contextModel writes curlpicks its own -A stringBash toolruns the commandOutside sitelogs the User-AgentSite bot policyasks for a contactPrivacy check2.1.317, text match
The leak needed three ordinary things: the address in context, a public site policy asking bots for a contact, and a shell tool that sends whatever the model writes. The 2.1.317 check sits only on the shell step.

What happened

On 5 November 2026 a user opened GitHub issue #107757 on the Claude Code repository, saying that version 2.1.318 on macOS had sent their account email address to third parties in the User-Agent request header while it researched the web. Within a day it had more than 660 thumbs-up reactions, and the Hacker News thread about it had passed 1,500 points and 470 comments.

It was not the first report. A search of the repository finds issue #78431 from 17 July 2026 (Claude Code v2.1.212), which was closed as not planned on 11 September, followed by #95258 on 18 September, #101659 on 13 October (a subagent, meaning a child agent the main session starts, doing the same), and #102577 on 15 October for Wikipedia requests. That four-month trail explains much of the anger.

How it worked, according to Anthropic

Lydia Hallie, who said on Hacker News that she works on Claude Code, explained the cause on 6 November and apologised. Users had reported that Claude invented names for things like @author tags, so Claude Code added the signed-in account's email to the context it gives the model. When Claude later wrote a command itself, such as a curl call, it sometimes put that address in the User-Agent as a contact, because some sites ask automated clients for one. She also said the interim check does not catch every case, such as a script Claude writes and runs on its own.

Again, this should not have happened, and we should've caught this behavior earlier.

Lydia Hallie, Hacker News, 6 November 2026

The sites in question are not exotic. The SEC's EDGAR access page asks scripts to declare a User-Agent in the form "Sample Company Name AdminContact@<sample company domain>.com". The Wikimedia User-Agent policy asks bots for "some way of contacting you" and says missing or generic User-Agents can fail with HTTP 403. A Hacker News commenter showed the SEC API returning 403 to curl's default User-Agent and 200 to one with an email, then added that the SEC accepts most non-curl strings, so the address was never required.

ONE REQUEST, AS THE THREAD REPRODUCED ITModelBash tooldata.sec.govcurl with default UA1GET companyconcept JSON2403: declare a User-Agent3retry: -A 'Name email@...'4200, UA now in their logs5
The model was solving a 403 the way the site's own documentation says to. The private data came from the context, which is why fixing the prompt alone was never going to be enough.

What the 2.1.317 check does and does not cover

Claude Code 2.1.317, released on 3 November, added what its notes call a check "that asks before a web or shell tool call sends your account email address to the network". Hallie said the email itself is being removed from the model's context in the next release, which she expected early the following week. She added that the stable channel was still on 2.1.311 and asked users to update to 2.1.317 or later. The 2.1.319 notes published on 6 November do not mention that removal yet.

The check ships as a built-in plugin, cc-plugin-privacy, whose source is in the repository's mods/privacy folder. Its README, read on 6 November, describes something narrower than the changelog line. It is one tool.check hook on Bash, PowerShell and Monitor calls that refuses a call whose input holds the address and names a User-Agent (User-Agent, curl -A, wget -U and similar). The changelog and Hallie describe it as asking first, but the README says it is two text matches with no parser, and it refuses without a prompt. The README calls itself "a courtesy, not a boundary" and lists what passes:

  • the address with no User-Agent named: in a URL, a request body, curl -u or a From: header;
  • WebFetch, WebSearch and MCP tool calls, which the hook does not read;
  • a value computed at run time, a variable, a file sent by name, or a script that holds the address;
  • any encoding other than one pass of percent-encoding.

Commenters found the same gaps, and one more: the check looks only for the signed-in address, so another address the model can see, such as the author email in git log, is not covered. The plugin can also be turned off with /plugin disable or "cc-plugin-privacy@builtin": false under enabledPlugins, though not from a repository's settings.

WHICH OUTBOUND PATHS EACH CONTROL COVERScaughthost checkedhost checkedallowed hosts onlyBash curl -A + emailFrom: header, body, URLWebFetch, MCP, scriptsPrivacy check (2.1.317)text match, shell onlySandbox allowlistproxy on shell trafficWebFetch domain rulespermission per hostThe network
The privacy check catches one shape of one leak. Host-level controls cannot read what is in a header, but they decide which sites can receive anything at all, and they cover paths the check never sees.

Why engineers care beyond one header

Two arguments run through the thread. One camp calls it a plain bug: personal data was placed where a tool-using model could copy it, and the fix is to keep it out. The other notes that the trigger was an instruction found in public documentation, which is the same shape as prompt injection even though the SEC meant no harm. Both point to the same engineering rule. Anything in an agent's context window can end up in a tool call, and a tool call that reaches the network is an exit.

Critics also asked for the root cause and argued that privacy should not rest on a plugin that can be switched off. Taking the address out of the context, which Anthropic says is coming in the next release, is the fix most of them asked for. Some readers doubted that the leak explained the spam the reporter received, which nobody has shown either way. We think the useful lesson is about layering: a regex hook is a good tripwire, but only an egress boundary that you configure, outside the model's judgement, survives the next variant.

What to do this week

  1. Check your version with claude --version. If it is below 2.1.317, run claude update. On the stable channel, which Hallie said was still on 2.1.311, set autoUpdatesChannel to "latest" first (Homebrew users switch to the claude-code@latest cask). Then watch the changelog for the release that removes the email from context.
  2. Make sure nobody has switched the check off: search your user and managed settings for cc-plugin-privacy@builtin.
  3. Turn on the sandbox with /sandbox and give it a short network allowlist. In your user settings, strictAllowlist makes other hosts fail instead of prompting, and allowUnsandboxedCommands: false stops Claude retrying a blocked command outside the sandbox. The sandbox docs say it covers shell commands only and that allowedDomains does not limit WebFetch, so pair it with WebFetch domain rules.
  4. Follow the permissions docs advice: deny curl and wget and allow WebFetch per domain, remembering that a Bash deny rule does not match the program by full path or inside sh -c, which is why the sandbox allowlist is the part that holds.
  5. In CI or shared setups, sign in with a service account, so the address in context is one you would accept in a stranger's access log.
~/.claude/settings.json (illustrative: swap in the hosts you need)
{
  "permissions": {
    "deny": ["Bash(curl *)", "Bash(wget *)"],
    "allow": ["WebFetch(domain:github.com)", "WebFetch(domain:*.npmjs.org)"]
  },
  "sandbox": {
    "enabled": true,
    "allowUnsandboxedCommands": false,
    "network": {
      "allowedDomains": ["github.com", "*.npmjs.org"],
      "strictAllowlist": true
    }
  }
}