[Server] Bind Streamable HTTP sessions to the authenticated principal
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 32/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- api, authentication, backend, security
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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?
- Lenguaje dominante
- PHP
- Estrellas
- 1.6k
- Forks
- 177
- Merge medio
- 5 d 8 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanAbiertoServer
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
modelcontextprotocol/php-sdk#468 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudlyPosiblemente ocupada @ousamabenyounes la tomó hace 50 días. Abiertoneeds confirmation needs maintainer action Server
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modelcontextprotocol/php-sdk#398 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modelcontextprotocol/php-sdk#370 ·
Los mantenedores suelen responder en 1 día
-
bug Server
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
modelcontextprotocol/php-sdk#522 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
enhancement Server
Dificultad 3/5 1-2 días Aptitud para principiantes 69/100
modelcontextprotocol/php-sdk#521 ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/php-sdk
Issues similares
-
Bug Enhancement Performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Feature Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
frontend low-priority
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
mplodowski/dynamicpdf-plugin#336 ·
Los mantenedores suelen responder en 1 día
-
Add ZammadPosiblemente ocupada @Arslan-TR la tomó hoy. Abiertorequest
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
endoflife-date/endoflife.date#11298 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
FriendsOfFlarum/best-answer#137 ·