Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Existing iss query parameters can produce ambiguous duplicate issuer values, and key response paths lack coverage.
3 open findings
What changed in this PR
Adds opt-in RFC 9207 issuer identification to authorization responses and discovery metadata.
Changes:
- Adds configuration and discovery support for RFC 9207.
- Emits
issin redirects, errors, fragments, and form-post responses. - Adds integration and helper tests plus README documentation.
| File | Description |
|---|---|
README.md |
Documents RFC 9207 support. |
pkg/op/server_legacy.go |
Enables issuer support in the legacy adapter. |
pkg/op/server_http.go |
Adds issuer to server authorization errors. |
pkg/op/op.go |
Adds the opt-in provider configuration. |
pkg/op/form_post.html.tmpl |
Renders the iss form field. |
pkg/op/error.go |
Adds issuer-aware error redirect helpers. |
pkg/op/discovery.go |
Advertises issuer-parameter support. |
pkg/op/authorization_response_iss_test.go |
Tests discovery and authorization responses. |
pkg/op/auth_request.go |
Adds issuer-aware response helpers and emission. |
pkg/oidc/discovery.go |
Defines the discovery metadata field. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3 tasks
7 tasks
wim07101993
reviewed
Nov 27, 2026
wim07101993
left a comment
Member
There was a problem hiding this comment.
Thank you for the contribution. PR looks good but I have a few comments
Add Config.AuthorizationResponseIssParameterSupported. When enabled, the issuer is returned as the iss parameter on every authorization response (code, token and error redirects, query, fragment and form_post) and discovery advertises authorization_response_iss_parameter_supported. One setting drives both, because RFC 9207 section 2.4 has clients reject responses without iss once support is advertised. The public helpers keep their signatures; AuthResponseURLWithIssuer, AuthResponseFormPostWithIssuer and TryErrorRedirectWithIssuer are added alongside them, and AuthorizationResponseIssuer is an optional interface so existing Configuration implementations keep compiling. Refs zitadel#1005
…ery response path An iss already in the query of a registered redirect URI is removed when the issuer is set, so the response carries exactly one. This applies to query, fragment and form_post responses. TestAuthorizationResponseIss now also covers token responses in fragment and form_post mode, and discovery through both the Provider and op.Server handlers.
Rebuilding the query through url.Values.Encode sorted and re-encoded every other registered callback parameter, which changed the query of fragment and form_post responses. Only iss components are now dropped, and all other components keep their original order and encoding.
…side query mode - The op.Server authorize error redirect decides from the provider of an ExtendedLegacyServer, as discovery and the callback do, so a server that embeds the interface no longer hides the setting. - iss is removed from the redirect URI's query only in query mode. Fragment and form_post responses keep the registered query as is. - AuthorizationResponseIss logs an error when the setting is on and the context carries no issuer. - AuthResponseURL, AuthResponseFormPost and TryErrorRedirect are deprecated in favour of their WithIssuer variants, and say they never set iss. - AuthorizationResponseIssuer is renamed AuthorizationResponseIssConfiguration, and its docs say an embedded interface hides it. - Tests: an op.Server embedding ExtendedLegacyServer, absent rather than empty iss, the escaped fragment, the code in the disabled form_post case, and the discovery key on the wire.
azuretek
force-pushed
the
feat-op-rfc9207-iss
branch
from
December 2, 2026 23:10
a6007ad to
db8fd1b
Compare
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
pkg/opdoes not implement RFC 9207. Authorization responses carry noissparameter and discovery does not advertiseauthorization_response_iss_parameter_supported, so clients cannot detect mix-up attacks. MCP clients such as ChatGPT depend on it.How the Problems Are Solved
Config.AuthorizationResponseIssParameterSupportedturns RFC 9207 on. It is off by default, and one setting drives both emission and discovery. Section 2.4 has clients reject responses withoutissonce support is advertised, and discard responses withisswhen it is not, so turning on only one of the two would break clients.AuthorizationResponseIssConfigurationis an optional interface implemented byProviderandLegacyServer. ExistingConfigurationimplementations and the generated mock keep compiling. Theop.Serverauthorize handler decides from the provider of anExtendedLegacyServer, as discovery and the callback do, so a server that embeds the interface still emitsiss.IssuerFromContextis set asisson every authorization response:AuthRequestError,LegacyServer.Authorizeand theop.Serverauthorize handler.issalready in the query of the registered redirect URI is removed, so the response carries exactly one issuer. In fragment and form_post mode the registered query is kept as is, since the OP'sissgoes in the fragment or the POST body.redirect_uri, soissnever reaches an untrusted target.AuthResponseURL,AuthResponseFormPostandTryErrorRedirectkeep their signatures, never setiss, and are deprecated.AuthResponseURLWithIssuer,AuthResponseFormPostWithIssuerandTryErrorRedirectWithIssuerare added alongside them, andAuthorizationResponseIss(ctx, v)returns the value to pass, logging an error when the setting is on and the context carries no issuer. Implementations that build their own callbacks can use these.DiscoveryConfigurationgainsAuthorizationResponseIssParameterSupported, set by bothCreateDiscoveryConfigand theop.Serverdiscovery.Additional Changes
form_post.html.tmplrendersiss. The template only renders the parameters it names, so without this form_post responses would drop it. With the setting off, the rendered page is byte-identical to before.Additional Context
iss) in authorization responses #1005TestAuthorizationResponseIssruns discovery, a storage error, a validation error, code andid_token tokenresponses in query, fragment and form_post mode againstProvider,op.Server, and anop.Serverthat embedsExtendedLegacyServer, with the setting on and off.TestAuthResponseURLWithIssuerandTestAuthResponseFormPostWithIssuercover a redirect URI that already hasiss.TestDiscoverpins the JSON key.go test -race ./pkg/...,go vet ./pkg/...and Staticcheck 2026.2.1 with every CI build tag pass.isson the RP side (pkg/client/rp) is left for a follow-up.