Skip to content

fix: reject cross-origin endpoint events in SSE client - #958

Open
ez-lbz wants to merge 1 commit into
modelcontextprotocol:mainfrom
ez-lbz:fix/reject-cross-origin-endpoint-in-sse-client
Open

fix: reject cross-origin endpoint events in SSE client#958
ez-lbz wants to merge 1 commit into
modelcontextprotocol:mainfrom
ez-lbz:fix/reject-cross-origin-endpoint-in-sse-client

Conversation

@ez-lbz

@ez-lbz ez-lbz commented Aug 16, 2026

Copy link
Copy Markdown

In the HTTP+SSE transport, the server's endpoint event tells the client where to POST subsequent JSON-RPC messages. The client currently accepts a full http(s):// URL as-is, so a compromised server could redirect all subsequent traffic — including auth headers — to an attacker-controlled host. The TypeScript and Python clients already reject endpoints whose origin differs from the connection origin.

This change rejects full-URL endpoints whose origin (scheme, host, and port, with default ports normalized) does not match the SSE connection's origin: the endpoint future completes exceptionally and the transport fails to start. Relative and root-relative paths keep their existing resolution, and same-origin full URLs keep their existing behavior.

Copilot AI lite review requested due to automatic review settings August 16, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants