[Server] Bind Streamable HTTP sessions to the authenticated principal
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 32/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- php
- Domínio
- api, authentication, backend, security
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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?
- Linguagem predominante
- PHP
- Estrelas
- 1.6k
- Forks
- 177
- Merge médio
- 3d 1h
- PRs com merge (30d)
- 27
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanAbertaServer
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
modelcontextprotocol/php-sdk#468 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudlyTalvez já em andamento @ousamabenyounes assumiu há 51 dias. Abertaneeds confirmation needs maintainer action Server
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
modelcontextprotocol/php-sdk#398 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
modelcontextprotocol/php-sdk#370 ·
Mantenedores costumam responder em até 1 dia
-
[Client] Expired HTTP sessions remain marked connected, including during cancellationTalvez já em andamento @ineersa assumiu hoje. Abertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
modelcontextprotocol/php-sdk#559 ·
Mantenedores costumam responder em até 1 dia
-
[Server][Streamable HTTP] Concurrent SSE streams on one session can consume each other's client responsesTalvez já em andamento @mglaman assumiu hoje. Abertabug P2 Server
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
modelcontextprotocol/php-sdk#544 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/php-sdk
Issues semelhantes
-
extension/Commercial needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
crazy-goat/rabbit-stream#753 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
opensourcepos/opensourcepos#4743 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
grokability/snipe-it#19786 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 3 dias