Repository navigation
Conversation
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.
Which Problems Are Solved
op.Servercannot sendissin authorization responses or advertiseauthorization_response_iss_parameter_supported(RFC 9207 sections 2 and 3), so its clients cannot detect mix-up attacks.rp.CodeExchangeHandlerignoresiss. It accepts a response with another server'siss, and one withoutissfrom an OP that advertises support (section 2.4).How the Problems Are Solved
OP, as proposed in #1043:
oidc.DiscoveryConfiguration.AuthorizationResponseIssParameterSupported(authorization_response_iss_parameter_supported,omitempty).op.CodeResponseType.Issuerandoidc.Error.Issuer, both encoded asiss.oidc.Error.Issuerisjson:"-", so token endpoint errors do not change.form_post.html.tmplrendersiss. Withoutissthe page is byte-identical.ServerOptionop.WithAuthorizationResponseIss(), off by default. With it, every error that/authorizeredirects after theredirect_uriis validated carriesissfromIssuerFromContext, in query, fragment and form_post mode. With no issuer in the context,server_erroris rendered instead of redirected.Server.Authorize: the implementation also sets the metadata field andIssueron the responses it builds itself.RP:
NewRelyingPartyOIDCreadsauthorization_response_iss_parameter_supportedfrom discovery.rp.VerifyAuthorizationResponseIss(rp, form). Everyissmust equalrp.Issuer()by simple string comparison. A missingissfails only when discovery advertised support. Errors wraprp.ErrAuthorizationResponseIss.CodeExchangeHandlercalls it before it readserrororcode, so an error response with a wrongissgoes to the unauthorized handler, not the error handler.rp.HasAuthorizationResponseIssinterface, likeHasUnauthorizedHandler, so customRelyingPartyimplementations keep compiling.Additional Changes
Test_webServer_authorizeHandler_iss(query, fragment, form_post, error fromAuthorize, option off, no issuer, redirect-disabled error),TestAuthResponseURLandTestAuthResponseFormPostwithCodeResponseType.Issuer,TestError_MarshalJSON,TestDiscoveryConfiguration_AuthorizationResponseIssParameterSupported,Test_CodeExchangeHandler_Iss(query and form_post) andTestVerifyAuthorizationResponseIss.Additional Context
iss) in authorization responses #1005.ProviderandLegacyServerare left to feat(op): RFC 9207 issuer identification in authorization responses #1006; the option says it is not forRegisterLegacyServeryet. The discovery field and the template line overlap with feat(op): RFC 9207 issuer identification in authorization responses #1006.issonce the metadata advertises support, and discard one withisswhen it does not. Emission and metadata have to switch on together. Withop.Serverthe success responses are built by the implementation, and the issuer comes from a context that existing deployments may not set, so the library cannot switch it on by default.issfrom an OP that does not advertise support is accepted rather than discarded, which section 2.4 leaves to local policy. An OAuth2-only RP has no issuer and is not checked.go test -race ./...,go vet ./...and Staticcheck 2026.2.1 with the three CI build tags pass.