GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — Bind client credentials to their authorization server (SEP-2352) by Kludex · Pull Request #2933 · modelcontextprotocol/python-sdk Conversation
Member
Implements SEP-2352 (the last client-side item of #2902): bind OAuth client credentials to their authorization server and re-register when it changes. What changedPersisted client credentials are now bound to the issuer that registered them.
Follows the Go SDK's approach (issuer field on the client-info, proactive comparison). The TS SDK takes a reactive invalidate-on-error path that doesn't fit our httpx auth-generator cleanly. ConformanceThe Both conformance legs pass with no stale or unexpected entries. #2902 statusThis completes the implementation of all five client-side items (SEP-2207, SEP-2468, SEP-837, SEP-2350, SEP-2352). The AS-migration conformance scenario will go green once the 2026 stateless client lifecycle lands. AI DisclaimerThis PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsPersisted client credentials are now bound to the issuer that registered them: OAuthClientInformationFull records an issuer, set by the SDK after DCR/CIMD. When protected resource metadata points at a different authorization server, the client discards the bound credentials and old tokens and re-registers, instead of presenting one server's client_id to another. URL-based client IDs (CIMD) are portable and always match; credentials with no recorded issuer (pre-registered, or stored before this change) carry no binding to enforce and are left as-is. No TokenStorage protocol change - the issuer round-trips through the existing get_client_info/set_client_info. Follows the Go SDK's approach. The auth/authorization-server-migration conformance scenario's re-register check is satisfied in spirit (no-reuse and no-cross-AS checks pass) but the scenario stays baselined: it runs at 2026-07-28, where client.py's 2025 lifecycle is rejected before the migration 401 fires. It unblocks with the 2026 stateless client lifecycle. - Stamp the bound issuer from the discovered oauth_metadata.issuer when PRM did not advertise an authorization server (legacy no-PRM path), instead of leaving it None — otherwise migrated resources could reuse the old DCR client_id. - Detect CIMD portability by the client_id equaling the configured client_metadata_url, not by URL shape, so a registration server that issues a URL-shaped client_id is still treated as bound to its issuer.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
maxisbey
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't find any bugs in this change, but it modifies the OAuth client credential-handling path (issuer binding, credential/token invalidation, and re-registration logic), so it warrants a human security-minded review rather than an automated approval. Extended reasoning...OverviewThe PR implements SEP-2352: Security risksThis is security-relevant code by nature: it governs whether persisted client credentials and tokens are reused or discarded across authorization servers. The logic looks sound — CIMD portability is keyed on the client_id equaling the configured Level of scrutinyOAuth/auth client code in the SDK warrants a higher bar than a mechanical change; per my approval criteria I do not auto-approve security-sensitive paths even when no bugs are found. The change is moderate in size and well-scoped, but it alters when credentials and tokens are invalidated mid-flow, which can affect existing users with persisted storage. Other factorsTest coverage is good: targeted unit tests for
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
7 of 9 tasks
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
This was referenced
9 of 11 tasks
maxisbey
added a commit
that referenced
this pull request
…r metadata Backport of the discovery half of #3398, together with the SEP-2352 credential binding that main has had since 2.0 and that change relies on (the parts of #2921, #2933, #2936, #2946 and #3181 it needs). The discovery step now knows which issuer the authorization server metadata must carry before fetching it: the PRM-advertised server, or on the 2025-03-26 no-PRM fallback the resource server's origin, which is what that well-known URL is built from (RFC 8414 section 3.3). On this line there was no issuer check at all; it now runs on both paths (`validate_metadata_issuer`, with `issuers_match`: exact, except that a root issuer with and without its trailing slash is the same server, which matters here because every parsed issuer renders with the slash). Stored client credentials gain the binding main has: the SDK records the issuer a registration was made with (`OAuthClientInformationFull.issuer`, never read from the registration response), and before any metadata is fetched a registration bound to a different issuer is discarded together with its tokens so the flow re-registers instead of presenting another server's credentials (`credentials_match_issuer`); newly registered clients are bound to the expected issuer when metadata for it was found and the registration actually went to that server. When no protected resource metadata location answers and one of them failed with a server error (or 429), the flow stops rather than reading that as "no such metadata". A 403 insufficient_scope step-up takes the same path as a 401: it discovers first when no metadata is held (extract_resource_metadata_from_www_auth also reads the `resource_metadata` hint from a 403 challenge) and then re-authorizes with the challenged scope; metadata already discovered in this process is reused as before. A 403 that is not a scope challenge is handed back to the caller instead of being retried unchanged. The conformance harness pinned on this line (0.1.13) still serves, in its two path-based authorization server scenarios, metadata whose `issuer` omits the advertised tenant path; those two scenarios are listed as expected failures until the pin moves past conformance 0.1.15, where the mock was corrected. Differences from the main change: - RFC 9207 `iss` validation is not included; the callback contract on 1.x stays `tuple[str, str | None]`. - 1.x has no SEP-2350 scope union, so a step-up asks for the challenged scope as it did before. - The root-slash allowance lives in `validate_metadata_issuer` itself (new on this line) rather than only on the legacy path.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | ||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |