Skip to content

fix: validate DCR redirect URIs#2955

Closed
fengjikui wants to merge 1 commit into
modelcontextprotocol:mainfrom
fengjikui:codex/dcr-redirect-uri-validation
Closed

fix: validate DCR redirect URIs#2955
fengjikui wants to merge 1 commit into
modelcontextprotocol:mainfrom
fengjikui:codex/dcr-redirect-uri-validation

Conversation

@fengjikui

Copy link
Copy Markdown

Summary

Fixes #2629.

  • validate dynamic client registration redirect URIs before storing the client
  • reject non-HTTPS, non-loopback, and fragmented redirect URIs with invalid_redirect_uri
  • keep HTTPS redirect URIs with query strings and loopback HTTP redirect URIs valid
  • update the interaction requirement now that the bundled registration handler enforces this boundary

Validation

  • uv run ruff check src/mcp/server/auth/handlers/register.py tests/interaction/auth/test_as_handlers.py tests/interaction/_requirements.py
  • uv run ruff format --check src/mcp/server/auth/handlers/register.py tests/interaction/auth/test_as_handlers.py tests/interaction/_requirements.py
  • uv run pyright src/mcp/server/auth/handlers/register.py tests/interaction/auth/test_as_handlers.py tests/interaction/_requirements.py
  • env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run pytest tests/interaction/auth/test_as_handlers.py tests/interaction/test_coverage.py -q
  • env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run pytest tests/server/mcpserver/auth/test_auth_integration.py -k client_registration -q
  • env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run coverage erase && env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run coverage run -m pytest -n auto && env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run coverage combine && env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run coverage report -> 2598 passed, 5 skipped, 9 xfailed, TOTAL 100.00%

@maxisbey maxisbey closed this Jun 23, 2026
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.

DCR registration accepts redirect_uris with non-HTTPS / non-loopback / fragmented schemes

2 participants