Repository navigation
Conversation
Public clients (token_endpoint_auth_method: 'none') without explicit auth-method provenance are now allowed when the request carries a non-empty client_secret or Basic header. The presented credential is ignored — the server never issued one, so skipping validation does not weaken security (PKCE and refresh rotation protect public clients). This restores 0.8.x behavior for clients whose integration platforms send credentials unconditionally, and prevents ~600 existing grants from breaking on upgrade. Fixes cloudflare#404
|
Comment on lines
+1232
to
+1234
| if (client.tokenEndpointAuthMethod === 'none' && isSecretMethod(presentedMethod)) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Comment on lines
+1229
to
+1233
| // Allow public clients that receive a spurious credential. Ignoring a | ||
| // secret the server never issued does not weaken public-client security, | ||
| // which rests on PKCE and refresh rotation (RFC 6749 §2.1). | ||
| if (client.tokenEndpointAuthMethod === 'none' && isSecretMethod(presentedMethod)) { | ||
| return true; |
There was a problem hiding this comment.
The normalization that overrides presentedAuthMethod to 'none' for backward-compat public clients was also firing for CIMD clients whose tokenEndpointAuthMethod is 'none' and authMethodExplicit is absent. This caused valid private_key_jwt assertions from CIMD clients to skip verifyClientAssertion, silently accepting unauthenticated requests. - Extract isCimdClient bool from the existing inline expression so it can be reused without duplication. - Move the presentedAuthMethod normalization to AFTER the isClientAuthMethodAllowed check (it was previously before, meaning it ran even for clients that would be rejected). - Gate normalization on !isCimdClient so CIMD assertion flows are never affected.
Comment on lines
+3001
to
+3004
| !isCimdClient && | ||
| registeredAuthMethod === 'none' && | ||
| presentedAuthMethod !== 'none' && | ||
| clientInfo.authMethodExplicit === undefined |
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores backward compatibility for public clients (
token_endpoint_auth_method: "none") that send aclient_secretor BasicAuthorizationheader at/token. Since 1.x (#276, #287), these requests are rejected with401 invalid_client(token_endpoint_auth_method_mismatch), breaking integrations that unconditionally include credentials.Empty
client_secret=is already handled (filtered as omitted per RFC 6749 §3.2). This PR extends backward compatibility to non-empty credentials on public clients without explicit auth-method provenance.Changes
src/oauth-provider.ts:isClientAuthMethodAllowed: add backward compat case fornoneclients receiving a secret method whenauthMethodExplicitis absentpresentedAuthMethodto'none'after the compat check so downstream secret validation is skipped (the server never issued a secret)Security rationale
Ignoring a credential the server never issued does not weaken public-client security, which rests on PKCE and refresh rotation (RFC 6749 §2.1). This matches 0.8.x behavior.
Test plan
client_secret=valuein POST body → accepted asnonenoneclient_secret=→ accepted (existing behavior)authMethodExplicitset is NOT compat-allowed (only legacy records)Fixes #404