fix(oauth-provider): PAR rejects unregistered redirect_uri#184
Merged
Conversation
runPostCallback was marking every PRE_REDIRECT_STEPS entry as 'pass' regardless of its actual outcome before the redirect — so any failure in the pre-redirect leg (PAR boundary tests, scope selection, metadata validation, etc.) would silently become green once the user came back from the auth server. Snapshot each pre-redirect step (status, message, evidence, timings) into the persisted state alongside codeVerifier/stateNonce, and restore from it after the callback. If no persisted result is present (older session storage), the steps render as 'skip' with a 'no persisted result' message rather than a fabricated pass.
RFC 6749 §3.1.2.4 requires the authorization server to reject any redirect_uri that was not registered in the client metadata. Cirrus checked this at the authorize step (provider.ts:370) but not at PAR, so a caller could obtain a valid request_uri for an unregistered redirect — defense-in-depth weakness flagged by pdscheck's flow.par-rejects-unregistered-redirect-uri check. Wire the existing ClientResolver into PARHandler and validate redirect_uri against client.redirectUris before issuing the request_uri. Adds a regression test covering the rejection.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
pdscheck | 8d858a8 | May 24 2026, 10:13 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
cirrusdocs | 8d858a8 | Commit Preview URL Branch Preview URL |
May 24 2026, 10:13 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
atproto-pds | 8d858a8 | May 24 2026, 10:13 PM |
commit: |
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.
Summary
pdscheck's `flow.par-rejects-unregistered-redirect-uri` step caught a defense-in-depth gap: Cirrus's PAR endpoint accepted any `redirect_uri` whose URL parsed cleanly, regardless of whether it was registered in the client metadata. RFC 6749 §3.1.2.4 requires rejection at this point. The subsequent `/oauth/authorize` step does re-validate (`provider.ts:370`), so the practical exploitability was limited — but issuing a `request_uri` for an unregistered redirect is itself a spec violation and a footgun if any code path elsewhere ever trusted the PAR-stored `redirect_uri` without re-checking.
Fix
Test plan