Skip to content

test(egress): Prove the browser check with real Node fetch headers - #3644

Merged
dcramer merged 3 commits into
mainfrom
feat/egress-browser-check-boundary
Nov 18, 2026
Merged

dcramer merged 3 commits into
mainfrom
feat/egress-browser-check-boundary

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Stacked on #3643. Until that merges, this diff includes its commit.

Sandbox egress gives no credential to a request that sends Sec-Fetch-Site, because that header marks it as coming from a browser. The old comment said this was "not a security boundary". That is wrong for the case the rule exists for. The placeholder is public, so a page script can send it. But a page script cannot remove or change Sec-Fetch-Site, and egress forwards only HTTPS, where browsers always send it. Other Sandbox code can leave the header out, but that gets it nothing that sending the placeholder would not. The comment now explains this.

The browser-none case now uses the headers that Node's built-in fetch really sends, read from a local server, instead of a hand-written copy. So the case catches a return to Sec-Fetch-Mode detection.

No behavior changes. The other rules stay:

  • The browser class stays. Without it, a page script that sends the placeholder gets the Actor's credential. For a plugin with tools-send-no-credential, a page request with no credential gets it too.
  • Junior does not detect Chromium by how it is started. Junior does not own the launch: agent-browser and Playwright start the browser, and any Sandbox code can start one. Egress catches traffic at the network level, so it cannot tell which process sent a request.
  • A carried credential still wins over the placeholder. Otherwise Junior could overwrite a real key that the request sends in another credential header.
  • A 401 on a request without a credential gets no hint. For carried, it is about the person's own token. For browser, it goes to a page, not to the agent. For none, a hint would mean rewriting the provider's response.

via @dcramer.

--

View Session [Sentry]

sentry-junior Bot and others added 2 commits November 18, 2026 06:44
Node's built-in fetch sends Sec-Fetch-Mode: cors on every request, so
the Sentry CLI's placeholder requests were classified as browser traffic
and forwarded with no credential. Detect browsers by Sec-Fetch-Site,
which Chromium sends and Node fetch does not.

Co-Authored-By: David Cramer <[email protected]>
Send the headers that Node's built-in fetch actually sends in the
browser-none case, so the test fails if browser detection goes back to
Sec-Fetch-Mode. Correct the comment: page scripts cannot remove or change
Sec-Fetch-Site, so the browser rule holds against them.
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 18, 2026 7:10am UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 18, 2026
…heck-boundary

Co-Authored-By: David Cramer <[email protected]>

# Conflicts:
#	packages/junior/src/chat/sandbox/egress/credential-request.ts
#	packages/junior/tests/integration/sandbox-egress-proxy.test.ts
@dcramer
dcramer enabled auto-merge (squash) November 18, 2026 07:09
@dcramer
dcramer merged commit c30eab5 into main Nov 18, 2026
47 checks passed
@dcramer
dcramer deleted the feat/egress-browser-check-boundary branch November 18, 2026 07:19

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 91b0b602 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant