[Server] Bind Streamable HTTP sessions to the authenticated principal
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/php-sdk#370 ·
メンテナーはふだん 1 日以内に返信
-
[Client] Expired HTTP sessions remain marked connected, including during cancellation対応中かも @ineersa が今日担当しました。 オープン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 日以内に返信