fix: validate MCP OAuth token endpoints - #2879
Open
dungdong-aws wants to merge 2 commits into
Open
dungdong-aws wants to merge 2 commits into
dungdong-aws wants to merge 2 commits into
Conversation
dungdong-aws
changed the base branch from
main
to
feature/mcp-security-enchance
September 17, 2026 19:17
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
Validates OAuth token endpoints before refresh-token and authorization-code exchanges for MCP servers.
Remote endpoints must use HTTPS. HTTP remains supported only for loopback endpoints used by local development:
Behavior
Validation runs immediately before both exchange paths:
Malformed URLs, unsupported schemes, non-loopback HTTP endpoints, and lookalike
hosts such as
localhost.example.comare rejected beforefetchCompat()is called.Screenshots
Screen.Recording.2026-09-17.at.12.10.47.PM.mov
Tests
Adds coverage for:
fetchCompat()call.Manual verification
Verified with a disposable local MCP/OAuth harness:
POST /token, proving the HTTPS path remains allowed;The harness intentionally does not implement the full MCP SSE transport, so its
final non-200 MCP transport response is expected after the endpoint-validation
check completes.
Validation