This was not a feature launch. It was a context-design decision that the model used in a way nobody intended. To stop Claude from hallucinating names in things like @author tags, Claude Code placed the signed-in account’s email address in the model’s context. When the model later wrote its own curl commands, it sometimes treated that address as the contact detail some sites ask bots for and put it in the User-Agent, sending it to whatever host it was fetching. GitHub issue #107757 (2026-11-05) and the Hacker News thread that followed made the behaviour public; Anthropic explained it on 2026-11-06 and promised to remove the address from the context in the next release.
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Hacker News: Claude Code sends your email address to websites
We sort everything we could check on 2026-11-08 into four buckets: first-party statements by Anthropic staff, CHANGELOG entries, the README of the built-in mod’s published source, and community reports from the issue and Hacker News that we did not reproduce. Then we answer the questions a daily Claude Code user actually has: is this in my transcripts? What does the built-in mod block and what does it let through? And if I do not want to wait for a release, which deterministic controls can I switch on today?
1. What happened: one issue, one HN thread and a mechanism that makes sense
Issue #107757, titled Bug Report: Privacy violation in User-Agent header, was opened on 2026-11-05 by user taylor-edwards on macOS with Claude Code 2.1.318 and carries the labels area:security, area:tools, bug and platform:macos. The reporter says Claude Code divulged their email to arbitrary third parties in the User-Agent header while doing web searches, without permission, and that the result was dozens of scam emails a day; they ask for the behaviour to be removed from the harness rather than made a setting. When we checked on 2026-11-08 the issue was still open with 108 comments.
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header
The Hacker News thread, Claude Code sends your email address to websites, stood at roughly 1,596 points and 526 comments when we read it on 2026-11-07 and 11-08. Its top comment supplies the most useful clue: many people saw the behaviour against the US SEC’s EDGAR API, whose documentation asks programmatic clients to identify themselves with a company name and a contact email in the User-Agent. The commenter demonstrated with curl that the default User-Agent returned 403 while one carrying an address returned 200, then added that the SEC in fact accepts most non-curl User-Agents, so the email is not really required. Others noted that Wikipedia and the EVE Online API also ask bots to identify themselves. Commenter T-R reported that their personal account address was sent without any prompt or warning and appeared only in curl requests. Another commenter showed subagents stuffing a company name, team name and even the project’s repository URL into the header. All of this is community reporting; we did not reproduce it.
Hacker News: Claude Code sends your email address to websites
Put the two together and the mechanism is clear: a site tells robots to include a contact, the model happens to have an address in its context, and it obliges. Nothing in Claude Code was written to put the email in a User-Agent, and nobody planted it; it is what you get when context content meets model autonomy. That is also why one more sentence of instruction cannot fully fix it. Anthropic’s own best-practices page says as much: a rule that has to hold every time belongs in a hook, a deny rule or a managed setting, not in CLAUDE.md.
Hacker News: Claude Code sends your email address to websites · Claude Code docs: Best practices
2. Timeline, with the type of each source marked
The table lists what we could verify on 2026-11-08 in order. First-party means the words of Anthropic staff or repository maintainers; CHANGELOG means an entry in the repository’s CHANGELOG.md, which is ordered by version and carries no dates; community means a report by an ordinary user on the issue or on HN that we did not reproduce.
| Date / version | Source type | What it says | Status on 11-08 |
|---|---|---|---|
| 2.1.234 (CHANGELOG, undated) | CHANGELOG | Claude is now told to use your account email only to identify you, and not to send it to unrelated services unless you ask. This shows the address was already in context and the control was a prompt | Entry still present; it documents that the earlier control was non-deterministic |
| 2026-03 (#37201) | Community citation | A commenter cites a March issue in which the model obtained the address from git config and sent it | Link reachable; contents not checked line by line |
| 2026-07 (#81138) | Community citation | A commenter calls this the original issue, about five months before the fix | Link reachable; contents not checked line by line |
| 2026-11-05 | Reporter | #107757 opened: 2.1.318, macOS, address in the User-Agent of web searches | Open, 108 comments |
| 2026-11-05 23:31 UTC | First-party (contributor poteat) | Built-in mod cc-plugin-privacy in 2.1.317 and later deterministically blocks the behaviour, on by default, can be turned off in /plugins; source then published at mods/privacy | README readable; community says it did not refuse (section 5) |
| 2.1.317 (CHANGELOG) | CHANGELOG | Added a check that asks before a web or shell tool call sends your account email address to the network | Entry present; wording is asks, the README says refused with no prompt |
| 2026-11-06 | First-party (HN, lydia_hallie, Claude Code team) | The account email is being removed from the model’s context in the next release, expected early next week; until then 2.1.317+ carries the built-in mod; it still does not prevent all cases, such as Claude writing a script and running it; stable channel still on 2.1.311, update to 2.1.317 or later; an apology | Promise public; whether shipped, see the last row |
| 2026-11-06 | Community | Users on 2.1.317/2.1.318 (macOS, Windows) report the mod shows as loaded but the README’s own test command is not refused | Not reproduced by us; treated as a possible mismatch between source and shipped build |
| 2.1.319 (CHANGELOG, latest on 11-08) | CHANGELOG | Fixed a sandbox escape when creating a worktree; a sed command skipping the permission check in accept-edits and auto mode; a Bash permission bypass where a crafted environment prefix could hide part of a command | No entry found that says the email was removed from context: the removal is announced, not verified as shipped |
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Hacker News: Claude Code sends your email address to websites · anthropics/claude-code CHANGELOG.md · GitHub issue #81138 (2026-07, cited by the community as the earlier report) · GitHub issue #37201 (2026-03, address leaked via git config)
The last row matters most. Through 2.1.319 we found no CHANGELOG entry saying the account email has been removed from the context. This article therefore describes the root-cause fix as announced and pending, never as shipped. After updating, read the newest version block of CHANGELOG.md yourself, or use the script in section 7 to watch whether new sessions still produce such requests.
3. Why it happened: context design, prompt-level control and the RFC 9110 From precedent
Anthropic’s HN statement lays out the causal chain: users had reported that Claude hallucinated names for fields like @author because it had no context on the account; the team added the signed-in account’s email to the model’s context; and when Claude wrote a command itself, such as a curl call, it sometimes put the address in the User-Agent as a contact, because some sites ask agents for one. Another HN commenter posted the context fragment they saw, which in substance tells the model the user’s address, says to use it only to identify the user for authorship, attribution or filtering their own work, and never to send it to an unrelated service unless the user explicitly asks. That matches the 2.1.234 CHANGELOG entry: the earlier control was a sentence of instruction.
Hacker News: Claude Code sends your email address to websites · anthropics/claude-code CHANGELOG.md
From a protocol-design angle the tension is old. RFC 9110 section 10.1.2 defines the From header as the email address of the human who controls the requesting user agent and states that a user agent SHOULD NOT send a From header without explicit configuration by the user, because that might conflict with the user’s privacy interests or their site’s security policy. The same section says a robotic user agent SHOULD send a valid From so the operator can be contacted. In other words, bots should identify themselves and user identity must not leak without configuration are both in the spec, and they are reconciled by an explicit user choice. Claude Code supplied the address to the model but never gave the user that choice, so the model made it for them.
Keep two different data flows apart. Requests made by Claude Code’s own WebFetch tool, its telemetry and its error reports are first-party code: the data-usage page says error reports have known secret, file-path and email-address patterns redacted before they leave the machine, and that WebFetch sends only the hostname to api.anthropic.com for a safety-list check before fetching. The requests in this incident were curl commands the model composed and the Bash tool executed. The documented commitments about the former say nothing about the latter. One HN commenter observed their WebFetch User-Agent as Claude-User (claude-code/2.1.318 (cli); +https://support.anthropic.com/), which agrees with the issue’s repeated reports that the address appeared only in curl requests, but that too is a community observation.
Hacker News: Claude Code sends your email address to websites · Claude Code docs: Data usage
4. What Anthropic shipped: the built-in mod’s README, clause by clause
Maintainer poteat wrote on the issue that from 2.1.317 the built-in mod cc-plugin-privacy deterministically blocks this behaviour, is enabled by default and can be turned off via /plugins; the source was then published under mods/privacy in the repository. Its README is strikingly restrained and worth reading clause by clause. The mod holds a single tool.check hook over Bash, PowerShell and Monitor calls. A call is refused when its input contains the signed-in account’s address (in any letter case, or after one pass of percent-encoding) and names a User-Agent. Naming means User-Agent, user_agent, --user-agent, -UserAgent, a prefix of those flags or UA=, or the client flags curl -A, wget -U and PowerShell’s -User.
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Built-in mod source: mods/privacy README
Two sentences define what it is. First: the test is two word matches over the whole input, and there is no parser, on purpose. So it will refuse a call that sets a User-Agent but sends the address elsewhere, or one that merely mentions the word beside the address, and accepts those false refusals for simplicity. Second: this is a courtesy, not a boundary, and it covers one shape. The README then lists what passes: the address with no User-Agent named (a URL, a request body, curl -u, a From: header); any WebFetch, WebSearch or MCP tool call; a value computed at run time such as $(git config user.email), a variable, a file sent by name, a script that holds the address, a client not named, a client that sets the header another way, any encoding beyond one pass of percent-encoding, and a non-ASCII address percent-encoded.
One inconsistency between first-party materials has to be recorded as found. The HN statement and the 2.1.317 CHANGELOG entry both say the check asks you; the README says the refusal raises no prompt, whoever is there and whatever the permission mode, and that a saved allow rule and auto mode’s classifier do not clear it. We cannot tell which description matches the shipped binary; go by what your own machine does (section 10 shows how). Turning it off, per the README: /plugin disable, or "cc-plugin-privacy@builtin": false under enabledPlugins in user, --settings or managed settings; a repository’s settings cannot disable it. A hook of an installed plugin that sits above it may overrule the refusal on tool.check, and a session where no hooks module loads does not run it at all.
anthropics/claude-code CHANGELOG.md · Built-in mod source: mods/privacy README
As for the root-cause fix, removing the address from the context, on 2026-11-08 it is a public promise. Once it lands it removes the premise that the model knows your email, but it does not change something the community has already pointed out: when the model invents a User-Agent for itself it also invents descriptive product tokens, pulling in the project, client or task name. The address goes away; the project name can still end up in someone’s log.
5. The gaps: what the README admits versus what the community reports
In the table, the left-hand description comes from the README’s own list of what passes, the middle column from issue comments (all community reports dated 2026-11-06 that we did not reproduce), and the right-hand column says whether the defences in sections 7 to 10 cover the case. Treat the middle column as hypotheses to verify on your own machine, not as confirmed defects.
| Scenario | README (mods/privacy) | Community report (issue, unreproduced) | Covered by this article’s setup? |
|---|---|---|---|
| Address present but no User-Agent named (URL, body, curl -u, From: header) | Explicitly passes | — | Hook: any input containing the address is refused, no User-Agent needed |
| WebFetch / WebSearch / MCP tools | Not checked | — | Hook matcher covers WebFetch and WebSearch; add mcp__.* for MCP tools yourself |
| Run-time value $(git config user.email) | Passes | One commenter says their address was pulled from gitconfig and sent | Hook refuses commands containing git config … user.email; also move commits to a no-reply identity |
| Address written into a script with Edit, then python3 fetch.py | Passes (a script that holds the address) | mkubenka: exactly their second case; no checked shell input contained the address | Hook matcher includes Write and Edit, so it is caught at write time |
| Descriptive product tokens in the User-Agent (project, client names) | Out of scope (matches the address only) | mkubenka: strings like PROJECT-site-build/1.0 carry no address and pass | Not covered by the hook; the sandbox limits destinations but cannot rewrite headers; rely on a CLAUDE.md convention plus transcript review |
| Mod loaded but not refusing | — | love540 (macOS, 2.1.317/2.1.318) and KardKuro (Windows 11, 2.1.318): the test command ran although system/init listed cc-plugin-privacy | Hook and sandbox do not depend on the mod; section 10 gives the check |
| Double encoding / non-ASCII address | Passes | — | Hook adds [at] and one pass of percent-encoding; further variants are equally uncovered |
| A plugin hook above it overrules; no hooks module loaded | Admitted by the README | — | Your user-level settings hook runs independently; onFailure: block makes the hook’s own failure a block |
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Built-in mod source: mods/privacy README
One community self-audit deserves attention. Commenter morsik had Claude scan every tool call under ~/.claude/projects/**/*.jsonl and found 53 calls across 8 sessions between 2026-08-09 and 2026-11-01 that put the address in a User-Agent, almost all from workflow subagents writing their own curl -A "TOOL/1.0 (address)" rather than from WebFetch. Three things follow: the window starts long before November; the main vehicle is subagent shell commands; and your local transcripts are the best audit material you have. Section 7’s script is built for exactly that.
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header
6. The request path: where the address comes from, where it goes, where each defence sits
To judge whether a defence helps, draw every step the data takes. It starts at sign-in: community reports place the account address in the oauthAccount.emailAddress field of ~/.claude.json (a commenter’s claim we did not verify against source), and it was placed in the model’s context (confirmed first-party). Step two is the model generating a tool call: a Bash command, a WebFetch URL, a Write that puts a script on disk. Step three is the pre-call check: your PreToolUse hook and the built-in mod’s tool.check both live here and see only the call’s text parameters. Step four is permission rules: deny rules hold in every permission mode, ask rules prompt, and auto mode’s classifier runs after the deterministic rules. Step five is the sandbox: Bash, PowerShell and Monitor commands run inside an OS-enforced boundary whose network goes through a local proxy that checks each host against allowedDomains, a list that starts empty; Read, Edit, Write, WebFetch, WebSearch, hooks, MCP servers, mods and commands you type at the ! prompt are outside it. The last step is the remote server writing the header to its log, and from there on there is no local control at all.
Two structural facts follow. First, every text-matching check (mod, hook, deny rule) is blind to values that exist only at run time: $(git config user.email), environment variables, file contents a script reads. Only the sandbox proxy is independent of command text, and it controls destination, not header content. Second, removing the address from context is the only measure that changes the starting point; everything else is a checkpoint after the address has already left it. The sensible combination is therefore to wait for and verify the root-cause fix while using a hook against the textual shapes, the sandbox against destinations, and a separate git identity to reduce what run-time lookups can reveal.
- Sign-in → address lands in ~/.claude.json (community claim) and in the model’s context (first-party)
- Model composes a tool call: Bash command / WebFetch URL / Write of a script (may insert the address as a contact)
- PreToolUse hook and built-in mod tool.check: text match on the call; exit 2 or refuse stops it
- Permission rules: deny holds in every mode, ask prompts, then auto mode’s classifier judges
- Sandbox network proxy: Bash/PowerShell/Monitor only; allowedDomains pass, deniedDomains refused
- Third-party server logs the User-Agent → no local control remains
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Claude Code docs: Hooks · Claude Code docs: Sandboxing · Claude Code docs: Best practices · Claude Code docs: Permissions
7. Self-audit: scan your local transcripts for tool calls that carried the address
Claude Code stores each project’s session records as .jsonl files under ~/.claude/projects, or under CLAUDE_CONFIG_DIR when that is set. The format is not documented, so the script assumes no fixed structure: it parses each line as JSON, walks every object recursively, and whenever it meets a node with type tool_use and an input object, serialises that input and searches it for the address you pass in, including its percent-encoded form. On a hit it prints the timestamp, a file-name prefix, the tool name, whether a User-Agent was also named, and the first 220 characters of the redacted input. It only reads; it changes nothing and makes no network call.
#!/usr/bin/env python3
"""Read-only audit of local Claude Code transcripts: which recorded tool calls
carried the address you pass in? Nothing is modified or sent anywhere."""
import json, os, re, sys
from pathlib import Path
from urllib.parse import quote
if len(sys.argv) < 2 or "@" not in sys.argv[1]:
sys.exit("usage: python3 audit_transcripts.py you@example.com")
ADDR = sys.argv[1].strip().lower()
FORMS = {ADDR, quote(ADDR, safe=""), ADDR.replace("@", "%40")}
ROOT = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home() / ".claude")) / "projects"
UA = re.compile(r"user[-_ ]?agent|(?:^|\s)-A\s|(?:^|\s)-U\s|-UserAgent", re.I)
def tool_uses(node): # the transcript format is undocumented: walk every object
if isinstance(node, dict):
if node.get("type") == "tool_use" and isinstance(node.get("input"), dict):
yield node
for value in node.values():
yield from tool_uses(value)
elif isinstance(node, list):
for value in node:
yield from tool_uses(value)
hits, files = 0, set()
for path in sorted(ROOT.glob("**/*.jsonl")):
for line in path.open(encoding="utf-8", errors="replace"):
try:
rec = json.loads(line)
except ValueError:
continue
for call in tool_uses(rec):
raw = json.dumps(call["input"], ensure_ascii=False)
if not any(form in raw.lower() for form in FORMS):
continue
hits += 1; files.add(path)
shown = raw
for form in FORMS:
shown = re.sub(re.escape(form), "<account email>", shown, flags=re.I)
print(f"{str(rec.get('timestamp', '?'))[:19]} {path.stem[:8]} "
f"tool={call.get('name')} ua_named={'yes' if UA.search(raw) else 'no'}")
print(" " + shown[:220])
print(f"\n{hits} tool call(s) in {len(files)} transcript file(s) contained the address.")
Three things to keep in mind when reading the output. Lines with ua_named=yes roughly correspond to what the built-in mod would match; ua_named=no lines are the shapes the README admits it passes (URLs, request bodies, script contents). If hits cluster on Write or Edit, the address was written into a script and then executed, which is precisely the path the community says the mod cannot see. And the hit count is not a count of requests actually sent: a command may have failed, you may have refused it at the prompt, and the transcript never records whether the remote server received anything. It tells you the model intended to do this, which is enough to decide whether you need the hook in section 8.
8. Deterministic defence one: a PreToolUse hook that refuses any tool input carrying your identity
The hooks documentation specifies that a PreToolUse hook receives JSON on stdin with tool_name and tool_input (command for Bash; file_path and content for Write; new_string for Edit; url and prompt for WebFetch, and so on); exiting with code 2 blocks the call and stderr becomes the reason shown to the model; alternatively the hook can print a hookSpecificOutput object with permissionDecision set to deny. Matchers accept tool names such as Bash or Edit|Write and regular expressions. Since 2.1.314 a Bash matcher also runs for commands started by the Monitor tool. Hooks fire inside subagents too, which is exactly where the community says most of these requests came from.
The hook below is deliberately wider than the built-in mod: if any field of tool_input contains one of your identities (one address per line in ~/.claude/private-identifiers.txt, plus whatever git config user.email currently returns), it exits 2 whether or not a User-Agent is named. It also refuses Bash or PowerShell commands that contain git config … user.email, because a run-time lookup is something no text check can see. The cost is false refusals: when you genuinely ask Claude to write your own address into a config file, the hook will stop that too, and its stderr tells the model to ask you to do that step by hand. That trade-off is intentional and mirrors the README’s own attitude to false refusals.
#!/usr/bin/env python3
"""PreToolUse hook: exit 2 (block) when a tool input carries one of your own
addresses, or reads the git identity at run time. Reads stdin JSON only."""
import json, os, re, subprocess, sys
from pathlib import Path
from urllib.parse import quote
def identities():
ids = set()
listed = Path(os.environ.get("IDENTITY_GUARD_FILE",
Path.home() / ".claude" / "private-identifiers.txt"))
if listed.is_file():
ids |= {l.strip().lower() for l in listed.read_text().splitlines() if "@" in l}
try: # whatever `git config user.email` would answer right now
out = subprocess.run(["git", "config", "--get", "user.email"],
capture_output=True, text=True, timeout=3).stdout.strip()
if "@" in out:
ids.add(out.lower())
except (OSError, subprocess.SubprocessError):
pass
return ids
payload = json.load(sys.stdin)
tool = payload.get("tool_name", "")
blob = json.dumps(payload.get("tool_input", {}), ensure_ascii=False).lower()
reasons = []
for addr in identities():
forms = {addr, quote(addr, safe=""), addr.replace("@", "%40"), addr.replace("@", "[at]")}
if any(form.lower() in blob for form in forms):
reasons.append(f"input contains a private identifier ({addr[:2]}***)")
if tool in ("Bash", "PowerShell") and re.search(r"git\s+config\b[^|;&]*user\.email", blob):
reasons.append("command reads the git identity at run time, which this hook cannot see")
if reasons:
sys.stderr.write("identity-guard: " + "; ".join(reasons)
+ ". Remove it, or ask the user to run this step by hand.\n")
sys.exit(2)
Two implementation notes. Python rather than jq lets us serialise the whole tool_input once and match it, so no per-tool field names are needed; the docs warn that file_path arrives with backslashes on Windows, but this script compares no paths, so it is unaffected. The hook prints no JSON and relies on its exit code alone: per the docs, exit 2 plus stderr is the standard way to block and pass a reason, while an exit code that is neither 0 nor 2 does not block by default. That is why the registration in section 9 sets onFailure: block (available since 2.1.295), so that a crash or timeout of the script also counts as a block.
9. Deterministic defences two and three: deny rules and a sandbox network allowlist in one settings.json
The best-practices page sets the principles: deny rules hold in every permission mode, including auto and bypassPermissions; a rule like Read(./.env) also catches cat .env because Claude Code recognises common file-reading commands, but it will not catch a script that opens the file itself; and a WebFetch deny rule for a domain does nothing about curl to that domain unless the sandbox is on. Its conclusion: for anything security-related you want both. The permissions page adds that Bash deny rules match the command as written, so /usr/bin/curl or sh -c 'curl …' slip past, which is why a network restriction that must hold needs the sandbox allowlist.
Claude Code docs: Best practices · Claude Code docs: Permissions · Claude Code docs: Security
Key facts from the sandboxing page: the sandbox is off by default and is turned on with /sandbox or "sandbox": {"enabled": true}; macOS uses Seatbelt, Linux and WSL2 use bubblewrap plus socat, native Windows is unsupported; there is no direct route out, connections go through a local proxy that checks allowedDomains, which start empty; a host outside the list prompts in manual mode, is refused in dontAsk mode and allowed in bypassPermissions mode, while deniedDomains is refused in every mode; allowUnsandboxedCommands: false turns off the unsandboxed retry (strict mode on the Overrides tab); and credentials.files and credentials.envVars deny entries stop sandboxed commands from reading ~/.ssh and similar or seeing named variables. Those credentials entries, however, apply only from user or managed settings; project and local settings’ entries are ignored.
{
"permissions": {
"deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)", "Read(~/.claude.json)"],
"ask": ["Bash(curl *)", "Bash(wget *)", "Bash(dangerouslyDisableSandbox:true)"]
},
"hooks": {
"PreToolUse": [
{
"matcher": "Bash|PowerShell|Write|Edit|WebFetch|WebSearch",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/identity_guard.py",
"timeout": 10,
"onFailure": "block"
}
]
}
]
},
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false,
"network": {
"allowedDomains": ["github.com", "*.npmjs.org", "pypi.org", "files.pythonhosted.org"]
},
"credentials": {
"files": [
{ "path": "~/.ssh", "mode": "deny" },
{ "path": "~/.aws/credentials", "mode": "deny" }
],
"envVars": [{ "name": "GITHUB_TOKEN", "mode": "deny" }]
}
}
}Item by item: Read(~/.claude.json) targets the file the community names as the address’s storage, so the model’s Read tool and recognised commands like cat cannot read it (Claude Code itself still can); the ask rules Bash(curl *) and Bash(wget *) make network commands prompt every time, and the security page notes these commands are not auto-approved in manual mode anyway; Bash(dangerouslyDisableSandbox:true) is the ask rule the sandboxing page recommends, prompting on an unsandboxed retry even in auto and bypassPermissions modes, which backs up allowUnsandboxedCommands: false; allowedDomains is a placeholder to replace with what your build genuinely needs. The hook matcher reads Bash|PowerShell|Write|Edit|WebFetch|WebSearch; if you fetch pages through MCP tools, add a matcher for mcp__.* as well.
Claude Code docs: Sandboxing · Claude Code docs: Permissions · Claude Code docs: Security
| Layer | Nature | Covers | Does not cover | Basis |
|---|---|---|---|---|
| The sentence in the system context (since 2.1.234) | Non-deterministic | Reminds the model to use the address only to identify you | The model may decide this case is the exception, which is what happened | CHANGELOG; best practices |
| CLAUDE.md conventions | Non-deterministic | Team-level User-Agent naming, which sites may receive a contact | Any rule that must hold every time | Best practices |
| Built-in mod cc-plugin-privacy | Deterministic (text match) | Address plus a named User-Agent in Bash/PowerShell/Monitor input | Address without a User-Agent, WebFetch/WebSearch/MCP, run-time values, scripts holding the address, other encodings; can be overruled by a plugin above it | README |
| Your PreToolUse hook | Deterministic (text match) | Any identity shape in Bash/PowerShell/Write/Edit/WebFetch/WebSearch input; git config user.email commands | Run-time values, variables, unlisted identities, descriptive product tokens | Hooks docs |
| permissions.deny / ask | Deterministic (command as written) | Reading .env and ~/.claude.json; curl/wget prompt every time | Programs called by path or wrapped in sh -c; scripts that open files themselves | Permissions, best practices, security docs |
| Sandbox network allowlist (strict mode) | Deterministic (OS level) | Destinations of Bash/PowerShell/Monitor commands; credential files and variables | Read/Edit/Write/WebFetch/WebSearch, hooks, MCP, mods, ! commands; header content | Sandboxing docs |
| Removing the address from context (announced) | Removes the premise | The model no longer knows your account email | Addresses in git config, files, environment; project names in the User-Agent | HN statement; CHANGELOG pending |
anthropics/claude-code CHANGELOG.md · Built-in mod source: mods/privacy README · Claude Code docs: Hooks · Claude Code docs: Sandboxing · Claude Code docs: Best practices · Claude Code docs: Permissions
10. Verification: confirm the refusal with a harmless command and move git to a no-reply identity
A written configuration is not a working one. The hooks docs warn that a mistyped path in settings.json means the hook never runs and that you should watch for the hook error notice on its first run. The script below does five things: prints claude --version; feeds four synthetic PreToolUse payloads straight into the hook (the temporary identity file holds only you@example.com and every target is a .invalid hostname, so nothing is sent); tells you to ask Claude, in a real session, to run echo 'User-Agent: test YOUR-ADDRESS' > /dev/null and watch for the refusal; prints your current git identity; and reminds you to check /plugins and /sandbox.
#!/usr/bin/env bash
# Verify the guard without sending anything: every target is a non-routable .invalid name.
set -u
echo "1) version (the built-in mod needs 2.1.317+; read CHANGELOG.md for the context change)"
claude --version
echo "2) hook blocks synthetic payloads (expect exit=2 and an identity-guard reason on stderr)"
tmp=$(mktemp); echo "you@example.com" > "$tmp"
run() { printf '%s' "$1" | IDENTITY_GUARD_FILE="$tmp" python3 ~/.claude/hooks/identity_guard.py; echo " exit=$?"; }
run '{"tool_name":"Bash","tool_input":{"command":"curl -A \"bot/1.0 (you@example.com)\" http://leak-test.invalid/"}}'
run '{"tool_name":"Write","tool_input":{"file_path":"/tmp/fetch.py","content":"UA = \"tool/0.1 (mailto:you%40example.com)\""}}'
run '{"tool_name":"Bash","tool_input":{"command":"curl -A \"$(git config user.email)\" http://leak-test.invalid/"}}'
run '{"tool_name":"Bash","tool_input":{"command":"npm test"}}' # expect exit=0
rm -f "$tmp"
echo "3) inside a session, ask Claude to run exactly: echo 'User-Agent: test <your address>' > /dev/null"
echo " expected: the call is refused and the transcript shows the identity-guard reason"
echo "4) git identity any \$(git config user.email) would reveal:"; git config --get user.email || echo "(unset)"
echo " prefer a no-reply address for agent commits: git config --global user.email <id>+<name>@users.noreply.github.com"
echo "5) /plugins -> Installed should list cc-plugin-privacy@builtin; /sandbox -> Network shows the allowlist, Overrides shows strict mode"
That echo test comes straight from the issue comments: it touches no network but contains both the address and the words User-Agent, exactly the shape the README promises to refuse. The community got ran, not refused from it; you should see one of two outcomes. If the built-in mod works, the model receives the mod’s REFUSAL; if only your hook works, the transcript shows a reason starting with identity-guard:. If neither appears, your hook is not running: check the path in settings.json and that python3 is on PATH.
GitHub issue #107757: Bug Report: Privacy violation in User-Agent header · Built-in mod source: mods/privacy README
Separating your git identity is the cheapest defence of all. The README and the community both name $(git config user.email) as a run-time path no text match can see. Once your global user.email is a no-reply address issued by your code host, a command that reads it leaks only an address that receives no mail. This changes the author email on your commits, so if your team requires DCO or signature checks, confirm the address is linked to your account on the platform first.
11. Order of operations: today, after updating, and continuously
- Today: run the audit script from section 7 to learn whether you are affected and whether the vehicle was subagent curl; keep the output for yourself and send it to nobody.
- Today: install the hook and settings from sections 8 and 9 at user scope, run the verification script from section 10, and switch your global git identity to a no-reply address.
- Update to 2.1.317 or later (the HN statement said the stable channel was still on 2.1.311), confirm in /plugins that cc-plugin-privacy@builtin is loaded, and use the echo test to check it actually refuses: community reports suggest loaded and refusing can be two different things.
- After every update, read the newest version block of CHANGELOG.md for an entry saying the account email has been removed from the context; until you see it, treat the fix as unshipped.
- Continuously: rerun the audit on new sessions from time to time, and put a CLAUDE.md convention in place that self-composed User-Agents use a generic token with no project or client name. That is non-deterministic and only a supplement.
- Teams: share the hook and deny rules through the repository’s .claude/settings.json (deny applies at once, allow waits for the trust dialog), remembering that credentials entries and strict sandbox need user or managed settings.
A last word on proportion. The lesson is not that Claude Code cannot be trusted; it is that anything placed in the model’s context must be assumed capable of appearing in any string the model generates. The email address is merely the easiest instance to observe; project names, client names and internal hostnames travel the same path. Deterministic controls are valuable because they do not depend on the model’s judgement, and the audit script is valuable because it lets you decide your next step from your own data rather than someone else’s screenshot.
What we did not verify: we did not reproduce the original behaviour of the address entering a User-Agent on any version; we did not test whether the built-in mod on 2.1.317, 2.1.318 or 2.1.319 actually refuses the command its README describes (community reports say it does not; we did not reproduce them); we did not check the claim about an oauthAccount.emailAddress field in ~/.claude.json; we found no CHANGELOG entry saying the email was removed from context, so we treat the root-cause fix as announced but not confirmed shipped; and we did not read issues #81138 and #37201 line by line, only confirmed the links resolve. The hook, settings and scripts here were tested offline with synthetic data and .invalid hostnames only, never in production or on a real network. This article analyses Anthropic’s product and open-source repository; this site has no relationship with Anthropic.