[Server] Bind Streamable HTTP sessions to the authenticated principal
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 32/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- php
- 領域
- api, authentication, backend, security
研究方向
Start from Protocol::resolveSession() and StreamableHttpTransport session load/destroy (Mcp-Session-Id, sessionManager exists/createWithId/destroySession) plus AuthorizationMiddleware. The issue wants a stable identity fingerprint stored on initialize and compared on later POST/DELETE (404 on mismatch). Read the linked MCP session-hijacking guidance, then decide with maintainers the open questions (always vs opt-in, Protocol vs store keying, opaque tokens) before coding; done is sessions bound to the principal without accepting another valid token on the same ID.
由索引模型根據 Issue 內容生成。
描述
Currently a stateful StreamableHttpTransport session is resolved only by its Mcp-Session-Id header - Protocol::resolveSession() checks sessionManager->exists() and loads it with createWithId(), and DELETE goes straight to destroySession(). With AuthorizationMiddleware in front, every request is still authenticated with the caller's own token and scopes are not inherited, but the session doesn't know which principal created it. So a request with a different valid token and the same session ID is accepted into that session, DELETE included.
Session IDs are random UUIDs, so this isn't easy to hit - still, the spec's security best practices say servers SHOULD bind session IDs to user-specific information: https://modelcontextprotocol.io/specification/2025-11-25/basic/security_best_practices#session-hijacking (the draft has the same as "state handle hijacking").
Thanks @GEONWOOHAN for bringing this up.
Rough direction:
AuthorizationResultexposes a stable identity - issuer + subject rather thansubalone, maybe the client id as well- the transport passes that into session resolution
- on
initializewe store a fingerprint of it in the session, later POST/DELETE compare and answer 404 on mismatch
Open questions:
a) bind always when an identity is present, or opt-in via the builder?
b) does it belong into Protocol or rather the session manager / store, so a custom store can key on <principal>:<session id>?
c) what about validators that don't produce a subject (opaque tokens, API keys)?
Keeping the core unaware of OAuth would be nice, so probably a plain identity string rather than the auth result itself.
WDYT?
- 主要語言
- PHP
- 星號
- 1.6k
- 分支
- 177
- 平均合併
- 3 天 1 小時
- 30 天內合併 PR
- 27
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
modelcontextprotocol/php-sdk 的其他 Issue
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan未關閉Server
難度 1/5 1 小時以內 新手友好度 78/100
modelcontextprotocol/php-sdk#468 · 2 則留言 ·
維護者通常 1 天內回覆
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudly可能已有人在做 @ousamabenyounes 於 52 天前認領。 未關閉needs confirmation needs maintainer action Server
難度 2/5 1-3 小時 新手友好度 68/100
modelcontextprotocol/php-sdk#398 · 1 個 reaction ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
modelcontextprotocol/php-sdk#370 ·
維護者通常 1 天內回覆
-
[Client] Expired HTTP sessions remain marked connected, including during cancellation可能已有人在做 @ineersa 於 1 天前認領。 未關閉bug
難度 4/5 3-5 天 新手友好度 25/100
modelcontextprotocol/php-sdk#559 ·
維護者通常 1 天內回覆
-
[Server][Streamable HTTP] Concurrent SSE streams on one session can consume each other's client responses可能已有人在做 @mglaman 於 1 天前認領。 未關閉bug P2 Server
難度 4/5 3-5 天 新手友好度 25/100
modelcontextprotocol/php-sdk#544 · 1 則留言 ·
維護者通常 1 天內回覆
查看 modelcontextprotocol/php-sdk 的全部 Issue
相似的 Issue
-
📚 Documentation: Placeholder link `link-to-realtime-docs` in Flutter SDK changelog可能已有人在做 @ShyneChikwapulo 今天認領。 未關閉api / realtime product / auth product / messaging product / vcs
難度 1/5 1 小時以內 新手友好度 82/100
appwrite/appwrite#14272 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 1/5 1 小時以內 新手友好度 75/100
Boavizta/boaviztapi#580 · 1 則留言 ·
-
Add Prestashop未關閉request
難度 2/5 1-3 小時 新手友好度 72/100
endoflife-date/endoflife.date#11303 ·
維護者通常 1 天內回覆
-
0. to triage enhancement
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆