Review fixes for SEP-2468 iss scenarios (stacks on #220)#1
Closed
pcarleton wants to merge 9 commits into
Closed
Conversation
Adds 5 draft conformance scenarios testing RFC 9207 issuer parameter validation in OAuth authorization responses: - auth/iss-supported: server advertises support and sends correct iss - auth/iss-not-advertised: server omits iss parameter entirely - auth/iss-supported-missing: client must reject missing iss when required - auth/iss-wrong-issuer: client must reject mismatched iss value - auth/iss-unexpected: client must reject iss when not advertised Also adds auth-test-iss-validation.ts, a reference client that correctly validates iss per RFC 9207, and negative tests confirming the standard client fails all three rejection scenarios. TODO: Update RFC_9207_ISS_PARAMETER spec reference once SEP-2468 (modelcontextprotocol/modelcontextprotocol#2468) is merged.
…o duplication The doc comments said 'Default: not included' but the destructure defaulted to true/'correct', and the `!== undefined` guard at L155 was unreachable — so there was no way to omit the metadata field, and IssParameterNotAdvertised silently advertised support (a duplicate of IssParameterSupported). Kept the on-by-default behavior (mock AS models a well-behaved server) but made issParameterSupported `boolean | null` so callers pass null to omit, matching the codeChallengeMethodsSupported pattern. Doc comments now match. Scenarios that need omission pass null/'omit' explicitly.
… endpoint correctlyRejected = !tokenRequestMade reports SUCCESS if the client errors out before hitting /authorize. Gate on authReached so a setup failure shows as FAILURE with authReached:false in details.
The spec table says: supported=false/absent + iss present -> *Compare* to the recorded issuer (not reject). The scenario sent a *correct* iss and FAILed compliant clients for proceeding after a successful comparison. Now sends a mismatched iss so the comparison fails and rejection is the spec-required outcome. Reference client updated to compare-when-present instead of throw-on-presence.
iss-advertised-in-metadata / iss-sent-in-redirect (and the not-* variants) fired in onAuthorizationRequest before the redirect happened, asserting only that the harness was configured correctly — a client that ignores iss passes identically. Replaced with one check per scenario keyed on tokenRequestMade, which observes that the client actually proceeded through the iss path.
One ID per spec table row; auth/iss-supported and auth/iss-wrong-issuer both emit sep-2468-client-compare-iss-supported (same comparison, opposite input) per the same-slug-for-SUCCESS-and-FAIL convention.
8 check rows (4 client table-row checks, 1 metadata-issuer, 2 AS-side, 1 no-normalization), 1 excluded (error-display is UI-facing). The record-issuer MUST is merged into the compare-iss-supported row text since it has no independent wire observation.
Merged
9 tasks
Replaces `specVersions: ['draft']` with `source: { introducedIn: DRAFT_PROTOCOL_VERSION }`
in the 5 iss-parameter scenarios.
This commit typechecks once the stack is rebased onto main >= #265 (the
ScenarioSource migration). Adding it now so the rebase is mechanical.
2958374 to
28a83ae
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.
Stacked on modelcontextprotocol#220 — review fixes for the SEP-2468
issparameter scenarios. One commit per finding so you can take or leave each independently; merge this intofeat/iss-parameter-conformance(or cherry-pick) and it'll flow through to modelcontextprotocol#220.Commits
issParameterSupportedis nowboolean | nullso callers can passnullto omit the metadata field, matching thecodeChallengeMethodsSupportedpattern. The!== undefinedguard at L155 was unreachable with a= truedestructure default, so there was no way to omit — andIssParameterNotAdvertisedScenariowas silently advertising support (a duplicate ofIssParameterSupported). It andIssParameterUnexpectednow passnull/'omit'explicitly. Doc comments updated to match.correctlyRejected = !tokenRequestMadereported SUCCESS on a setup failure. Now gated onauthReached.absent + iss present → Compare, not reject. Scenario sent a correctissand FAILed compliant clients for proceeding. Now sends a mismatchedissso rejection is the spec-required outcome; reference client updated to compare-when-present.iss-advertised-in-metadataetc. fired inonAuthorizationRequestand asserted only that the harness was configured correctly. Replaced with one check per positive scenario keyed ontokenRequestMade.auth/iss-supportedandauth/iss-wrong-issuernow sharesep-2468-client-compare-iss-supported.check:rows, 1excluded:.Coverage after this stack
check:client-compare-iss-supportedauth/iss-supported,auth/iss-wrong-issuerclient-reject-missing-issauth/iss-supported-missingclient-compare-iss-unadvertisedauth/iss-unexpectedclient-proceed-no-issauth/iss-not-advertisedclient-validate-metadata-issuerclient/auth/discovery-metadata.ts)client-no-normalizationas-include-issas-advertise-iss-supportedLeft as prose (not in this stack)
source: { introducedIn }replacesspecVersions) and feat: add new-sep scaffolding command modelcontextprotocol/conformance#272 (src/seps/directory). After rebase thespecVersions: ['draft']lines inissuer-parameter.tswill need to becomesource: { introducedIn: DRAFT_PROTOCOL_VERSION }. Thesep-2468.yamlin this stack lands in a directory that only exists post-rebase.auth-test-iss-validation.ts— we're working towards deleting these examples from this repo and preferring linking to WIP branches for testing, or released sdk versions, and just making that linking flow easier. i left this in here for now, but will aim to delete with the bigger deletion.npx vitest run src/scenarios/client/auth/index.test.ts→ 35/35 pass on this stack.