[Server] Bind Streamable HTTP sessions to the authenticated principal
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 32/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- php
- Bereich
- api, authentication, backend, security
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- PHP
- Sterne
- 1.6k
- Forks
- 177
- Ø Merge
- 3 T. 1 Std.
- Gemergte PRs (30 T.)
- 27
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanOffenServer
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
modelcontextprotocol/php-sdk#468 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudlyEvtl. vergeben @ousamabenyounes hat das vor 51 Tagen übernommen. Offenneeds confirmation needs maintainer action Server
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/php-sdk#398 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/php-sdk#370 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Client] Expired HTTP sessions remain marked connected, including during cancellationEvtl. vergeben @ineersa hat das heute übernommen. Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
modelcontextprotocol/php-sdk#559 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Server][Streamable HTTP] Concurrent SSE streams on one session can consume each other's client responsesEvtl. vergeben @mglaman hat das heute übernommen. Offenbug P2 Server
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
modelcontextprotocol/php-sdk#544 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/php-sdk
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
run-fpm-phpt.sh refuses FPMNG_PHPT_PORT_BASE, so the upstream suite cannot use a reserved laneOffenarea:test-harness help wanted priority:low type:chore
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
crazy-goat/php-fpm-ng#913 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
10up/10up-experience#238 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
laravel/nova-issues#7002 ·
-
extension/Commercial needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 2 Tagen