Skip to content

Oauth rfc9207 issuer identification - #9

Merged
Azdaroth merged 2 commits into
masterfrom
oauth-rfc9207-issuer-identification
Aug 28, 2026
Merged

Oauth rfc9207 issuer identification#9
Azdaroth merged 2 commits into
masterfrom
oauth-rfc9207-issuer-identification

Conversation

@Azdaroth

Copy link
Copy Markdown
Member

No description provided.

Adds `iss` to the authorization response and advertises
`authorization_response_iss_parameter_supported` in the authorization server
metadata. RFC 9207 is mixed-up-authorization-server defence: it names which
server produced a response, so a client registered with several cannot be
induced to redeem a code at the wrong one.

It is also the fix for hosted clients that choose their redirect URI from
whether the server supports it. ChatGPT connectors use the stable
`https://chatgpt.com/connector_platform_oauth_redirect` when the server
conforms, and a per-connector `https://chatgpt.com/connector/oauth/{callback_id}`
when it does not — a URI no exact-match allowlist can express. Confirmed in
production: 9 rejections over two days, all naming the per-connector form.

No control is relaxed. The redirect allowlist is untouched and still
exact-match (RFC 9700 §2.1); conforming makes the client ask for a URI that is
already on it. The alternative — matching the vendor's callbacks by pattern —
would let an attacker name their own destination inside the prefix, so the
README now records why that is not the fix.

- `iss` is response-owned alongside `code`/`state`: a caller that seeds one into
  its own redirect_uri has it replaced, not appended.
- `iss` must byte-match the advertised `issuer` (clients compare by exact
  string). Both derive from `mcp_oauth_issuer`, which reads `request.base_url`
  and so honours X-Forwarded-Host — a spec pins the redirect against the
  discovery document rather than a literal, so any divergence fails here.
- `approve` is the only response this bridge redirects; every error path renders
  (400/422), so there is no error response for `iss` to be absent from.

619 examples/0 failures (all 4 new assertions verified red without the change),
RuboCop 65/0, Brakeman 0.
The rationale (mixed-up authorization server, RFC 9207 §2's MUST, why `approve`
is the only redirect that can carry `iss`) was written into the source as a
12-line block minutes after working it out. It is already in the previous commit
message and the CHANGELOG, and the code shows what matters: `iss` is
`mcp_oauth_issuer`, the same method the metadata renders.

Also renames the loopback describe, which said "its own code" while now covering
a seeded `iss` too.

24 added comment lines -> 2.
@Azdaroth
Azdaroth merged commit b4ea811 into master Aug 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant