Skip to content

fix(mcp): Let browsers send Origin on the consent POST - #2638

Merged
dcramer merged 1 commit into
mainfrom
fix/mcp-consent-origin-null
Nov 4, 2026
Merged

dcramer merged 1 commit into
mainfrom
fix/mcp-consent-origin-null

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Clicking Allow on the MCP consent page always returned "Request blocked".

The page sets Referrer-Policy: no-referrer. Under that policy, the Fetch spec has browsers send Origin: null on a non-CORS POST. That includes a same-origin form submit. requestHasSameOrigin then fails, so every approve or deny got the 403 page. The ACP page uses the same check and works, because it doesn't set no-referrer.

The fix switches to Referrer-Policy: same-origin. The consent POST keeps its real Origin. The redirect to the MCP client is cross-origin, so the client still gets no referrer, and the consent URL doesn't leak.

The integration test missed this because the fixture hardcoded Origin. The fixture now builds Origin from the page's referrer policy, the same way a browser does. With the old header, 5 MCP route tests fail. With the fix, they pass.

Reported in Slack: https://sentry.slack.com/archives/C0B595QDZLL/p1793750566935369

via @dcramer.

--

View Session [Sentry]

The consent page set Referrer-Policy: no-referrer. Under that policy,
browsers send Origin: null on a form POST, so the same-origin check
rejected every Allow click with "Request blocked". Use same-origin
instead: the consent POST keeps its Origin, and the cross-origin
redirect to the client still gets no referrer.

The test fixture now derives Origin from the page's referrer policy the
way a browser does, so the integration test catches this.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@vercel

vercel Bot commented Nov 4, 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 4, 2026 12:09am UTC

Request Review

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

2 screenshot changes — 2 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Share Details · Desktop
Conversation Share Details · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@dcramer
dcramer merged commit 8357ce2 into main Nov 4, 2026
47 checks passed
@dcramer
dcramer deleted the fix/mcp-consent-origin-null branch November 4, 2026 00:19
dcramer added a commit that referenced this pull request Nov 4, 2026
The MCP consent page was a bare text column. This PR gives it the
dashboard look. The ACP sign-in pages share the shell, so they change
too.

- `renderHtmlPage` now ships one inline `<style>` block with the
dashboard tokens (zinc canvas, panel card, white primary button,
lavender focus ring). It also has a `prefers-color-scheme: light`
variant. The page still loads no resources, so CSP is unchanged.
- Consent: the requested scopes show as a bordered list, each with its
scope id. "Only continue if you started this connection" moved into its
own amber callout. Deny and Allow are equal-width buttons, with Allow as
the primary one.
- Buttons and inputs are at least 44px tall and have visible focus
states. Inline `style=` attributes are gone from these pages.

Independent of the "Request blocked" fix in #2638, which only changes
the `referrer-policy` header.

| Before | After (dark) |
| --- | --- |
| <img
src="https://junior-prod.sentry.dev/public/artifacts/5ca6765e-8a88-4121-b215-336f7f2ccd7d.png"
width="420"> | <img
src="https://junior-prod.sentry.dev/public/artifacts/de8ea389-2126-43b7-ae8d-a6fa0c1da745.png"
width="420"> |

| Mobile | Light |
| --- | --- |
| <img
src="https://junior-prod.sentry.dev/public/artifacts/5ba26595-5801-461a-bca5-6fd3c70ea083.png"
width="200"> | <img
src="https://junior-prod.sentry.dev/public/artifacts/766c223b-887f-4217-8f73-934fa3b950ba.png"
width="420"> |

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A8c5086518f88cae99ab6f32f0c7427f9 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A8c5086518f88cae99ab6f32f0c7427f9)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A8c5086518f88cae99ab6f32f0c7427f9/?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 <23610+dcramer@users.noreply.github.com>

This branch was successfully deployed

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

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant