PKCE verification: 2025-11-25 requires refusing when `code_challenge_methods_supported` is absent, which conflicts with the #832 / #992 resolution
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 28/100
- Tipo de issue
- Funcionalidade
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- authentication, security
Direção de pesquisa
Comece com startAuthorization, OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema e a reprodução de auth() descrita na issue. Primeiro, resolva qual das quatro políticas propostas é desejada; considera-se concluído quando o comportamento selecionado para um campo code_challenge_methods_supported ausente estiver implementado e seu desvio ou rigor estiver documentado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
This is a follow-up to #832 and #992, not a report that the check is missing — it is deliberately
permissive, and this is about the spec moving underneath that decision.
#992 made startAuthorization treat an absent code_challenge_methods_supported as "assume PKCE is
supported", to unblock Azure AD and AWS Cognito, whose OIDC discovery documents omit the field while
the providers do support S256. The reasoning in #832 was explicitly "if the list isn't present,
assume it's there, and rely on the requests later failing if you send PKCE parameters that the AS
doesn't support."
The MCP specification has since taken the opposite position. The 2025-11-25 revision's
"Authorization Code Protection" section requires clients to verify PKCE support from
authorization-server metadata and to refuse when the field is absent — stated separately for RFC
8414 metadata and for OpenID Connect Discovery, the latter precisely because OIDC provider metadata
does not define the field. It also tells OIDC providers to publish it for MCP compatibility.
The 2025-06-18 revision does not mention code_challenge_methods_supported at all, so this
requirement post-dates #992. The SDK currently implements the #992 behavior and therefore does not
satisfy the 2025-11-25 requirement.
Current behavior
@modelcontextprotocol/client 2.0.0, startAuthorization:
if (metadata.code_challenge_methods_supported &&
!metadata.code_challenge_methods_supported.includes(AUTHORIZATION_CODE_CHALLENGE_METHOD)) {
throw new Error(`Incompatible auth server: does not support code challenge method ...`);
}
The leading truthiness check makes an absent field a no-op. At the schema level the field is
.optional() on OAuthMetadataSchema, and OpenIdProviderDiscoveryMetadataSchema picks that same
optional field, so an OIDC document without it parses clean and proceeds to authorization.
Reproduction
Serve authorization-server metadata with no code_challenge_methods_supported (issuer,
authorization_endpoint, token_endpoint, response_types_supported: ["code"]) and run the
auth() flow. It completes; nothing is raised or surfaced.
Why this is worth revisiting rather than closing
The #832 rationale holds for the common case and I am not arguing it should be reverted: PKCE
parameters are still sent, so a server that supports PKCE but omits the advertisement remains fully
protected. The gap is narrower than "no PKCE".
What the current behavior cannot do is distinguish that server from one that ignores code_challenge
outright, and it gives an embedder no signal that the distinction was unresolvable. "Rely on the
requests later failing" does not hold for this specific failure mode: an authorization server with
no PKCE support does not reject a request carrying code_challenge, it ignores the parameter, and
the flow succeeds with the protection silently absent.
Possible resolutions
- Surface the condition without changing the flow — a documented callback, a warning, or a field on
the returned discovery state — so embedders can apply their own policy. This preserves #992 and is
the smallest change. - An opt-in strict mode that refuses, defaulting to today's behavior.
- Refuse as the spec requires, with an opt-out for the OIDC case. Spec-correct, but reintroduces the
#832 breakage as the default. - Document the deviation from 2025-11-25 explicitly, so embedders know the check is theirs to make.
We implemented (1) plus (2) at the gateway layer and would be happy to send a PR for whichever
direction you prefer here.
Environment
@modelcontextprotocol/client 2.0.0 (latest at time of filing).
- Linguagem predominante
- TypeScript
- Estrelas
- 13.6k
- Forks
- 2.5k
- Merge médio
- 1d 5h
- PRs com merge (30d)
- 62
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/typescript-sdk
-
[v1.x] Protocol.request keeps its abort listener after the request resolved, so a later abort sends notifications/cancelled for an answered request (1.30.0)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertav1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
modelcontextprotocol/typescript-sdk#3090 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[v2] e2e `protocol:timeout:max-total` is flaky over SSE: fake timers advance before the request reaches the serverTalvez já em andamento @Singmin assumiu há 6 dias. Abertav1 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
modelcontextprotocol/typescript-sdk#3045 ·
Mantenedores costumam responder em até 1 dia
-
[v1.x] Backport #2654: `notifications/cancelled` with `requestId: 0` is ignored, so the first server→client request cannot be cancelled (still in 1.32.1)Talvez já em andamento @CloudCorpRecords assumiu há 7 dias. Abertav1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
modelcontextprotocol/typescript-sdk#3043 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
v1 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
modelcontextprotocol/typescript-sdk#2946 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
-
[v2] URI template reserved expansions encode existing %HH sequences againTalvez já em andamento @takagibit18 assumiu há 22 dias. Abertav1 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/typescript-sdk
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
farion1231/cc-switch#8829 ·
Mantenedores costumam responder em até 1 dia
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverAbertadoc-audit enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100