Writing / ai engineering

What Your Coding Agent Sends Out

Claude Code put users' account emails into the User-Agent of requests it wrote. The real lesson is not about one bug: anything in an agent's context can leave your machine. Here is how to check what yours sends, and how to set safer defaults.

In early November the most upvoted story on Hacker News was not a new model. It was a privacy bug in a coding agent.

On November 5 a user opened issue #107757 on the Claude Code repo. Their report: while doing web searches, Claude Code had sent their account email address to third-party sites in the User-Agent header, and they were now getting dozens of scam emails a day. The Hacker News thread passed 1,600 points and 500 comments.

I am not writing this to dunk on one tool. Every agent that can run curl has the same basic risk. This bug just made it visible. So this post is about what actually happened, why it is a pattern and not a one-off, and how to check what your own agent sends out.

What happened

The cause is almost boring, which is exactly why it is worth understanding.

Lydia Hallie from the Claude Code team explained it on Hacker News. Users had complained that Claude made up names for things like @author tags, because it did not know who the user was. So Claude Code started putting the signed-in user’s email into the model’s context.

The changelog for version 2.1.234 even says it: “Claude is now told to use your account email only to identify you, and not to send it to unrelated services unless you ask.”

Then the model met the open web. Some sites, Wikipedia being the classic example, ask scripted clients to identify themselves with a contact address in the User-Agent. When Claude wrote its own curl call to such a site, it sometimes did the polite thing and filled in a contact address. The one it had in context. Yours.

Nobody built a “send the user’s email to websites” feature. A helpful detail went into the context, a prompt told the model to keep it private, and the model still used it when a website asked for a contact address.

What changed since

Here is the timeline as far as I can verify it from the Claude Code changelog:

Version Change
2.1.234 Model told to use the account email only to identify you
2.1.317 New check asks before a web or shell tool call sends your account email to the network
2.1.321 Shell commands containing your email and naming a User-Agent are refused outright
2.1.325 Check extended to scripts a command runs, file writes, web fetches and MCP calls

Hallie also said the email would be removed from the model’s context entirely in a release the following week. As I write this, the changelog goes up to 2.1.332 and I could not find an entry for that change. Maybe it shipped without a changelog line, but I can’t confirm that.

The check itself is a built-in mod called cc-plugin-privacy, on by default. Early reports in the issue showed gaps. One user found the 2.1.317 check did not refuse the exact case it was documented to refuse. Another found that the User-Agent strings Claude wrote also contained project and client names, which no email check would catch. Hallie herself said the first version did not cover every case, for example Claude writing a script and then running it.

Two things worth noting if you use Claude Code:

  • At the time of the fix, the stable channel was still on 2.1.311, which predates all of the checks. Check which version you are actually running.
  • The privacy mod can be turned off under /plugins. Make sure nobody on your team did that.

Why this is a pattern, not a bug

The most useful sentence in the whole thread came from a Hacker News commenter:

The email can be removed from the context but not everything can.

Think about what an agent typically has in context while it works:

  • your name and email from git config and git log
  • client and project names from the repo, the folder path, the README
  • internal hostnames, ticket IDs, branch names
  • whatever was in the files it read: .env, config, customer data in fixtures
  • the task itself, which might describe unreleased plans

Now give that agent a tool that can make arbitrary HTTP requests, and point it at web pages written by strangers.

Every page the agent reads is input. Some sites already include instructions for agents, like documentation pages that ask agents to call an endpoint with a goal parameter describing what the user is trying to do. That is not malicious by itself, but it is exactly the shape of a prompt-injection attack. The agent wants to be helpful. The page asks it to describe your work. Your work leaves the building.

In the email case, the only weird thing was that the leak looked polite. A contact address in a User-Agent is what a well-behaved script should send. That is why it slipped through.

The general rule I take from it:

If something is in the agent’s context and the agent can reach the network, assume it can leave your machine.

A prompt that says “keep this private” lowers the odds, but it does not stop the leak. The Claude Code prompt already said that, and the email still got out.

How to check what your agent sends

You don’t have to trust any vendor’s statement, including mine. You can watch the traffic.

The setup suggested in the issue thread uses mitmproxy, a local intercepting proxy. Do this in a throwaway project, not real work.

1. Plant canaries

Create a fresh directory with:

  • a file containing a unique string, for example canary-7f3a9e
  • a local git config with a fake but unique name and email:
mkdir /tmp/agent-audit && cd /tmp/agent-audit
git init
git config user.name "Canary Person"
git config user.email "canary-7f3a9e@example.com"
echo "Project codename: canary-7f3a9e" > NOTES.md
git add . && git commit -m "init"

If either string shows up in an outgoing request, you know exactly where it came from.

2. Route the agent through a proxy

Start mitmproxy and launch the agent from a shell that points at it. For Node-based CLIs that respect the proxy variable:

mitmdump -p 8080 -w /tmp/agent-audit.flows

# in another shell:
export HTTPS_PROXY=http://127.0.0.1:8080
export NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem
cd /tmp/agent-audit
claude   # or whichever agent you use

This does not change trust settings system-wide. It only affects that one shell.

If you capture nothing at all, don’t celebrate. It probably means the CLI does not honour HTTPS_PROXY. Check its docs before concluding nothing leaked.

3. Give it a task that touches the web

Ask the agent to do something realistic:

  • “Look up the Wikipedia article on X and summarise it into NOTES.md.”
  • “Fetch the latest release of library Y from its API and tell me the version.”
  • “Write a small script that downloads Z and run it.”

The last one matters. Several of the gaps reported in the issue were in scripts the agent wrote and then executed, not in its direct tool calls.

4. Search the captured traffic

mitmdump -nr /tmp/agent-audit.flows --flow-detail 3 \
  | grep -iE 'canary-7f3a9e|your-real@email\.com|User-Agent'

Look at three things:

  • Headers, especially User-Agent, From, and anything custom
  • Query strings, where “goal” or “context” parameters hide
  • Request bodies, for POSTs the agent made on its own

Also look at where requests went. Telemetry to the vendor is expected and usually documented. Requests to sites you never mentioned are not.

Safer defaults

Auditing tells you what happened. Defaults decide what happens next time. These are the ones I’d set, roughly in order of how much they help.

Keep personal data out of the context

The cleanest fix is the one Anthropic promised: don’t give the model the data. You can do the same for your own setup:

  • Use a project-specific git identity (a noreply address) for repos where agents work.
  • Keep real .env files out of what the agent reads, and use example files with fake values.
  • Don’t paste customer data into a session that also has web access.

The email is often “just a git log away,” as one commenter put it. If git log only shows a noreply address, that path is closed.

Enforce rules in the harness, not just the prompt

A prompt rule is a request. A hook or permission check is code that runs every time.

Most serious agent harnesses now let you run checks before a tool call: block commands that contain certain strings, require approval for network tools, or restrict which domains can be fetched. If your harness supports it, write a check that refuses any outgoing request containing your real email or your client names. It is ten lines of code and it does not depend on the model behaving.

One user in the issue thread published their prompt-level rules for User-Agent strings, with an allow-list of sites. That is a good start, but the whole story of this bug is that prompt-level rules were already there. Treat them as documentation for the model, and the hook as the actual control.

Separate “reads private stuff” from “talks to the internet”

This is the same idea as the builder/checker split I wrote about in managing AI agents like a team: don’t give one role every permission.

  • A session working on a client repo with real data: no web access, or an allow-list.
  • A research session that browses the web: no access to the private repo.

Mixing both in one context is convenient, and it is also how the email leak happened.

Prefer a harness you can inspect

This is one reason I use Oh My Pi and like running agents in the terminal in general. I can see the system prompt, the tool definitions, and what goes into context. Several people in the issue thread made the same point when they said they were moving to open harnesses.

An open harness does not make you safe. A model can still put your git email into a User-Agent in any harness, if the email is in its context. But when the harness is open, you can at least find out why, and fix it without waiting for the next release.

Re-check after updates

Agent CLIs ship fast. Claude Code went through more than a dozen versions in the weeks after this report alone. A canary audit takes a few minutes once the setup exists. Run it again after major updates, or when you add a new MCP server or plugin.

The short version

  1. The Claude Code bug happened because a harmless detail entered the context, and the model used it in a request it wrote itself.
  2. Anything in an agent’s context can leave your machine if the agent can reach the network. Prompt rules reduce that risk. They don’t remove it.
  3. Audit with canaries and a local proxy instead of trusting vendor statements.
  4. Keep personal data out of context, enforce rules in hooks, and keep private work and web access in separate sessions.

Agents doing web requests for us is genuinely useful. The defaults around that just need the same care we already give to credentials in CI. Assume it will leak unless something actually stops it.

I hope to see you next time. Steve out. Tschau!