Repository navigation
fix(egress): Stop treating Node fetch as a browser - #3643
Merged
Merged
Conversation
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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
approved these changes
Nov 18, 2026
dcramer
left a comment
Member
There was a problem hiding this comment.
verification seems awfully complex/suspect here. if there's a way to improve it do it in a follow up thread
Contributor
|
10 screenshot changes — 10 changed · 0 added · 0 removed Review screenshots in Frameshift |
24 tasks done
dcramer
added a commit
that referenced
this pull request
Nov 18, 2026
…3644) 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. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A0c7cdfeff85f5999f42c2e047ec62701 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A0c7cdfeff85f5999f42c2e047ec62701) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A0c7cdfeff85f5999f42c2e047ec62701/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sentry CLI calls from the Sandbox return
401 Invalid token, and nobody is asked to reconnect. The CLI sends the placeholder (Authorization: Bearer host_managed_credential), but the audit log recordsapp.sandbox.egress.credential_request: "browser". So Junior forwards the placeholder as is.#3556 detects a browser by
Sec-Fetch-Mode. Node's built-in fetch sendsSec-Fetch-Mode: corson every request, so every Node CLI,sentryincluded, counts as a browser.curlsends noSec-Fetch-*headers, which is why curl with the placeholder still works.Detect browsers by
Sec-Fetch-Siteinstead. Chromium sends it on every HTTPS request, and Node fetch does not. The rule is still a guard against page traffic, not a security boundary. The plugin docs and the verify-junior feature file now name the new header.Other Node-based CLIs in the Sandbox, such as
vercel, probably hit the same misclassification and get fixed by this too.via @dcramer.
--
View Session [Sentry]