[Server] Bind Streamable HTTP sessions to the authenticated principal
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- api, authentication, backend, security
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- PHP
- Stelle
- 1.6k
- Fork
- 177
- Merge medio
- 3g 1h
- PR unite (30g)
- 27
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanApertaServer
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
modelcontextprotocol/php-sdk#468 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudlyForse già presa @ousamabenyounes l’ha presa 52 giorni fa. Apertaneeds confirmation needs maintainer action Server
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/php-sdk#398 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/php-sdk#370 ·
I maintainer di solito rispondono entro 1 giorno
-
[Client] Expired HTTP sessions remain marked connected, including during cancellationForse già presa @ineersa l’ha presa oggi. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
modelcontextprotocol/php-sdk#559 ·
I maintainer di solito rispondono entro 1 giorno
-
[Server][Streamable HTTP] Concurrent SSE streams on one session can consume each other's client responsesForse già presa @mglaman l’ha presa 1 giorno fa. Apertabug P2 Server
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
modelcontextprotocol/php-sdk#544 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/php-sdk
Issue simili
-
📚 Documentation: Placeholder link `link-to-realtime-docs` in Flutter SDK changelogForse già presa @ShyneChikwapulo l’ha presa oggi. Apertaapi / realtime product / auth product / messaging product / vcs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
appwrite/appwrite#14272 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
Boavizta/boaviztapi#580 · 1 commento ·
-
Add PrestashopApertarequest
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
endoflife-date/endoflife.date#11303 ·
I maintainer di solito rispondono entro 1 giorno
-
0. to triage enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno