Skip to content

fix(claude-code, claude-bun): sync the firewall's Claude hosts with the network requirements - #314

Open
gatezh wants to merge 5 commits into
masterfrom
claude-code/firewall-claude-hosts
Open

gatezh wants to merge 5 commits into
masterfrom
claude-code/firewall-claude-hosts

Conversation

@gatezh

@gatezh gatezh commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What

The sandbox firewalls now allow platform.claude.com, claude.ai and downloads.claude.ai, and no longer allow statsig.com and sentry.io. This brings them in line with Claude Code's documented network requirements.

Why

Claude Code's network requirements list these Anthropic hosts besides the API:

  • platform.claude.com: OAuth token exchange, refresh and revocation, for claude.ai accounts too, and the first-run connectivity check.
  • claude.ai: claude.ai account authentication.
  • downloads.claude.ai: plugin executable downloads.

A downstream project had to add all three to its allowed-domains.txt. Every Claude Code container needs them.

The table no longer lists statsig.com or sentry.io. Nothing in the images contacts them either:

  • The 2.1.332 CLI binary contains no statsig host.
  • The VS Code extension's JS names neither host.
  • The CLI's only Sentry host is its ingest DSN, o1158394.ingest.us.sentry.io. It resolves to different IPs, so the sentry.io entry never carried that traffic.

Both entries only let the agent reach statsig.com's website and Sentry's web app and API. They came from Anthropic's reference init-firewall.sh, which still lists them.

Changes

  • claude-code/.devcontainer/init-firewall.sh, claude-bun/.devcontainer/init-firewall.sh, .devcontainer/claude-sandbox/init-firewall.sh: the three hosts are added and the two are removed. The claude-code script's comment says the list follows the docs table, not the upstream reference, so a future upstream sync doesn't add the hosts back.
  • claude-code/README.md: the firewall defaults sentence names the new hosts. "Sandbox Authentication" no longer says the firewall blocks sign-in. The token stays the documented path because it can only make model requests, while a sign-in leaves a full claude.ai login in ~/.claude where the agent can read it.
  • claude-code/.devcontainer/claude-sandbox/devcontainer.json and .devcontainer/claude-sandbox/devcontainer.json: the CLAUDE_CODE_OAUTH_TOKEN comments give that same reason.
  • claude-bun/README.md: the allowed-services table gains a "Claude sign-in and downloads" row and loses the Sentry and Statsig rows.

Notes

  • Egress cost: claude.ai and platform.claude.com resolve to 160.79.104.10, the IP api.anthropic.com already opened. They add no new address, and sign-in already worked through the firewall before this PR. downloads.claude.ai adds 35.190.46.17. That address serves only the downloads.claude.ai/downloads.claude.com certificate, whatever SNI is sent, so it is a dedicated Google Cloud forwarding rule, not a shared CDN address. claude-code template: the sandbox firewall allows whole shared CDN IPs, so each allowlisted CDN host likely opens unrelated sites #296 doesn't apply to it.
  • Probe: I ran the claude-code script and this repo's sandbox copy over the published sandbox image with NET_ADMIN/NET_RAW. Both exit 0 and pass their own checks. Results: platform.claude.com token endpoint 400, claude.ai 403 (Cloudflare challenge, so reached), downloads.claude.ai 200, statsig.com, sentry.io and the Sentry ingest host refused.
  • Still blocked, on purpose: storage.googleapis.com (plugin install counts in /plugin) and the two Datadog telemetry hosts. All three are optional, and storage.googleapis.com is Google's shared front end (claude-code template: the sandbox firewall allows whole shared CDN IPs, so each allowlisted CDN host likely opens unrelated sites #296). Setting DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC would also turn off feature flags, so neither is set.
  • Checks: bash -n and shellcheck -S warning pass on all three scripts, which stay 100755. Both devcontainer.json files parse. No CI or verify-image.sh line asserts the domain list.
  • Wiki: nothing goes stale. Troubleshooting.md "Claude Code authentication" still recommends the token.
  • Downstream: once the image ships, projects can drop these three hosts from their allowed-domains.txt.

… through the firewall

Claude Code's network requirements list platform.claude.com (OAuth token exchange,
refresh and revocation, for claude.ai accounts too, plus the first-run connectivity
check), claude.ai (account auth) and downloads.claude.ai (plugin executables). The
firewalls allowed only api.anthropic.com, so a downstream project had to add all
three to its allowed-domains.txt. Added to the claude-code image's defaults, the
claude-bun firewall and this repo's own sandbox, with both READMEs updated.
… firewalls

Neither host is in Claude Code's network requirements any more, and nothing in the
images contacts them: the 2.1.332 CLI binary holds no statsig host, the VS Code
extension's JS names neither, and the CLI's only Sentry host is its ingest DSN
(o1158394.ingest.us.sentry.io), which resolves to other IPs that the sentry.io
entry never opened. The entries only let the agent reach statsig.com's website
and Sentry's web app and API. They came from the upstream reference script,
which still lists them; the comment says the list follows the docs instead.
"Sandbox Authentication" and two devcontainer.json comments said the firewall
blocks the browser login. The browser half runs on the host; the container's
half is the token exchange at platform.claude.com, which answers through the
firewall (it shares api.anthropic.com's IP, so it did before this branch too).
The token injection stays the documented path, for the reason that holds: a
setup-token token can only make model requests, while a sign-in leaves a full
claude.ai login in ~/.claude for an agent running with prompts skipped.
The firewall comment said Claude Code no longer uses sentry.io, but the CLI still
reports errors to a Sentry ingest host. What holds is that the sentry.io entry
never carried that traffic.
@gatezh gatezh changed the title fix(claude-code, claude-bun): allow Claude's sign-in and plugin hosts through the firewall fix(claude-code, claude-bun): sync the firewall's Claude hosts with the network requirements Nov 27, 2026
@gatezh
gatezh added this pull request to stack #321 November 27, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant