Repository navigation
Conversation
added 4 commits
October 9, 2026 18:09
…rigin When a request to /sse fails the transport-security checks (DNS-rebinding protection: disallowed Host -> 421, disallowed Origin -> 403), connect_sse sends the rejection response and then raises ValueError to signal the caller that no SSE session was established. FastMCP.sse_app()'s handle_sse had no handler for it, so the exception escaped the ASGI callable and uvicorn crashed the whole server process -- one malformed request killed every client (reported in modelcontextprotocol#3661 via ida-pro-mcp's idalib-mcp). Catch ValueError in handle_sse: the rejection response has already been sent to that one client, so just return. Also document connect_sse's send-then-raise contract so future callers know to handle it. Adds a regression test driving MCPServer.sse_app() with a disallowed Host through the in-process ASGI bridge: 421 returned and no exception escapes. 32 server/security tests pass (1367 in tests/server/).
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.
dup check only