Repository navigation
fix(client/auth): discard stored client registrations whose secret has expired - #3264
Open
claude[bot] wants to merge 9 commits into
Open
claude[bot] wants to merge 9 commits into
claude[bot] wants to merge 9 commits into
Claude / Claude Code Review
completed
Aug 7, 2026 in 5m 51s
Code review found 4 potential issues
Found 4 candidates, confirmed 4. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 4 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/mcp/client/auth/oauth2.py:638-646 |
Expiry discard preempts the SEP-2352 issuer-mismatch cleanup |
| 🟡 Nit | src/mcp/client/auth/oauth2.py:639-647 |
Mid-session expiry re-check misses the refresh path and the 403 step-up path |
Annotations
Check warning on line 646 in src/mcp/client/auth/oauth2.py
claude / Claude Code Review
Expiry discard preempts the SEP-2352 issuer-mismatch cleanup
The new expiry discards (in `_initialize` and at the top of the 401 handler) null `context.client_info` before the SEP-2352 issuer-binding checks — which are guarded on `client_info is not None` and read the issuer stamp from `client_info.issuer` — so a record that is both expired and issuer-mismatched (AS migration) now skips the SEP-2352 cleanup (`clear_tokens()` + `oauth_metadata = None`) that fired pre-PR. The old issuer's kept refresh token can then later be presented to the new AS's token
Check warning on line 647 in src/mcp/client/auth/oauth2.py
claude / Claude Code Review
Mid-session expiry re-check misses the refresh path and the 403 step-up path
The new mid-session `stored_registration_expired()` re-check only runs inside the 401 branch, but `prepare_token_auth()` is also reached from two other paths when the secret lapses after `_initialize()`: the refresh branch (`can_refresh_token()` ignores expiry, so one refresh presents the dead secret and fails `invalid_client` before self-healing via the subsequent 401), and the 403 `insufficient_scope` step-up, where the live access token keeps the 401 discard from ever running — each 403 burns
Loading