Negotiate CIMD token endpoint auth method - #6400
Open
alex-feel wants to merge 1 commit into
Open
Conversation
CIMD documents from live clients can declare a preferred token_endpoint_auth_method this server does not support while also publishing a plural token_endpoint_auth_methods_supported list (OpenID Connect RP Metadata Choices 1.0) that includes a method the server does support, and the server rejected the whole document without ever looking at that list. Add TokenEndpointAuthMethodsSupported to ClientMetadataDocument and negotiate the effective auth method from it before falling back to the prior outright rejection, mirroring the same describes-capability-across-every-AS reading the grant_types/response_types filtering already applies to CIMD documents. The negotiated set stays the server's own supported constant rather than the AS discovery document's advertised methods, since discovery may legitimately advertise symmetric methods that CIMD documents are never allowed to declare. The change is a pure widening: no document accepted today becomes rejected, and the existing singular-only rejection test is unchanged. Signed-off-by: Aleksandr Filippov <71711753+alex-feel@users.noreply.github.com>
alex-feel
requested review from
ChrisJBurns,
JAORMX,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
August 20, 2026 14:08
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
CIMD documents from live clients (observed with ChatGPT) can declare a preferred
token_endpoint_auth_methodthis server does not support while also publishing a pluraltoken_endpoint_auth_methods_supportedlist (per OpenID Connect Relying Party Metadata Choices 1.0) that includes a method the server does support (none). The server rejected the whole document without ever consulting that list.TokenEndpointAuthMethodsSupportedtoClientMetadataDocument.grant_types/response_typesfiltering for CIMD documents.Fixes #6278
Type of change
Test plan
Ran
gofmt -lon the changed files,go build, andgo vetacrosspkg/authserver/...andpkg/oauthproto/...(all clean), andgo test -count=1 ./pkg/authserver/... ./pkg/oauthproto/...(all packages green).TestFetch_TokenEndpointAuthMethodNegotiationcovering three cases: an unsupported singular method rescued bynonein the supported list, an unsupported singular method with no mutually supported method still rejected, and an omitted singular method with a plural list present accepted exactly as before.TestFetch_RejectsUnsupportedTokenEndpointAuthMethodis unchanged and still green, so the previously pinned contract for singular-only documents holds.Changes
pkg/oauthproto/cimd/fetch.goTokenEndpointAuthMethodsSupported []stringfield toClientMetadataDocumentpkg/authserver/storage/cimd_decorator.gonegotiateTokenEndpointAuthMethod; pass the negotiated method intobuildFositeClientas a new parameter, removing its internal empty-to-nonefallbackpkg/authserver/storage/cimd_decorator_test.goDoes this introduce a user-facing change?
Yes: CIMD clients previously rejected outright for declaring an unsupported preferred
token_endpoint_auth_methodare now accepted when theirtoken_endpoint_auth_methods_supportedlist names a method this server supports (none). This is a pure widening: no document accepted today becomes rejected.Special notes for reviewers
nonerather than the value the discovery endpoint advertises, because discovery may legitimately advertiseclient_secret_basic/client_secret_postfor other client types, and CIMD documents are never allowed to declare symmetric methods.TestFetch_RejectsUnsupportedTokenEndpointAuthMethodtest is unchanged and still passes, so the previously pinned contract for singular-only documents holds.