Uh oh!
There was an error while loading. Please reload this page.
fix: reject changed duplicate initialize - #2606
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
he-yufeng
commented
Jun 10, 2026
Rebased this PR onto the current runner/connection architecture instead of keeping the old Validation:
|
f77411a to
f96c27eComparef96c27e to
74ae395Comparehe-yufeng
commented
Jun 22, 2026
Rebased onto current |
he-yufeng
commented
Jul 13, 2026
Bumping this. A second initialize with changed params can still shift session state after the handshake, so rejecting the changed duplicate keeps initialization once-only per the spec. Rebases cleanly on main if there is interest. |
Summary
initializerequest if it tries to change the session's client parametersclient_paramsintact so later capability checks cannot be spoofed by a duplicate handshakeTo verify
uv run pytest tests/server/test_session.py -q -k "duplicate_initialize or server_session_initialize"uv run ruff check src/mcp/server/session.py tests/server/test_session.pyuv run pyright src/mcp/server/session.py tests/server/test_session.pyuv run python -m py_compile src/mcp/server/session.py tests/server/test_session.pygit diff --checkCloses#2605