Skip to content

Emit RFC 9207 iss on OAuth authorization responses - #125

Open
aterga wants to merge 1 commit into
mainfrom
claude/oauth-iss-rfc9207
Open

Emit RFC 9207 iss on OAuth authorization responses#125
aterga wants to merge 1 commit into
mainfrom
claude/oauth-iss-rfc9207

Conversation

@aterga

@aterga aterga commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Name the issuer on every /oauth authorization-response redirect with an iss parameter (RFC 9207), and advertise support via authorization_response_iss_parameter_supported in the RFC 8414 authorization-server metadata.

RFC 9207 lets a client detect an authorization-server mix-up before it redeems a code: a client that sees the metadata flag compares the response iss against the issuer it started the flow with and rejects a mismatch. The value we emit is byte-for-byte the metadata issuer ({public_url}{mcp_path}), which clients compare by exact string. This is a natural fit for a path-issuer-per-instance server: a client that started at /mcp and is handed a code stamped for /mcp-beta can now catch it.

This surfaced in the MCP 2026-07-28 alignment review as a small, spec-independent OAuth hardening win, implemented here on its own so it can land ahead of the larger alignment work.

Related issues

Changes

  • build_redirect gains an iss argument and appends the percent-encoded &iss=... after code and any state.
  • connect_redeem binds let iss = store.issuer(); once and threads it through all three redirect call sites, including the two idempotent replays (existing-code and RedeemClaim::Existing).
  • authorization_server_metadata (RFC 8414) now advertises authorization_response_iss_parameter_supported: true.
  • Only success redirects carry iss; the OAuth error paths render pages or return JSON rather than redirecting to the client, so there is no error-redirect to stamp.
  • Unit test build_redirect_encodes_code_state_and_iss covers ordering and encoding (with and without client state); the routers integration test asserts the new metadata flag.

Testing

  • cargo build --locked --all-targets
  • cargo test --locked --all-targets (165 tests: 151 lib + 6 main + 8 routers, all pass)
  • cargo fmt --all / cargo clippy --all-targets (tree is warning-free) — repo tree has pre-existing rustfmt-version drift and clippy warnings in discover.rs; no CI fmt/clippy gate exists, and this change adds none
  • npm test --prefix monitoring/mcp-status (if the dashboard changed) — dashboard unchanged

Checklist

  • I have read the Contributing guidelines.
  • Docs (README / comments) updated for any user-visible change.
  • No secrets, credentials, or internal-only information are included.

🤖 Generated with Claude Code

https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym


Generated by Claude Code

Name the issuer on every /oauth authorization-response redirect with an
`iss` parameter, and advertise support via
`authorization_response_iss_parameter_supported` in the RFC 8414
authorization-server metadata.

RFC 9207 lets a client detect an authorization-server mix-up before it
redeems a code: it compares the response `iss` against the issuer it
started the flow with and rejects a mismatch. The value we emit is
byte-for-byte the metadata `issuer` (`{public_url}{mcp_path}`), which
clients compare by exact string.

`build_redirect` gains an `iss` argument and appends the (percent-encoded)
parameter after `code` and any `state`; `connect_redeem` threads the
issuer through all three redirect call sites, including the idempotent
replays. Only success redirects carry `iss`; the OAuth error paths render
pages or return JSON rather than redirecting to the client.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
@aterga
aterga requested a balanced review from Copilot August 6, 2026 15:41
@aterga
aterga marked this pull request as ready for review August 6, 2026 15:41
@aterga
aterga requested a review from a team August 6, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds RFC 9207 issuer identification to OAuth authorization responses and advertises support through RFC 8414 metadata.

Changes:

  • Appends encoded iss values to successful authorization redirects.
  • Advertises issuer-parameter support in authorization-server metadata.
  • Adds redirect encoding and metadata assertions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/auth.rs Emits iss, updates metadata, and tests redirect construction.
tests/routers.rs Verifies the metadata support flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants