Skip to content

Enforce redirect URI scheme policy at authorization time - #281

Open
aaronjae22 wants to merge 4 commits into
scope-validator-reviewfrom
feat/redirect-uri-scheme-enforcement
Open

Enforce redirect URI scheme policy at authorization time#281
aaronjae22 wants to merge 4 commits into
scope-validator-reviewfrom
feat/redirect-uri-scheme-enforcement

Conversation

@aaronjae22

Copy link
Copy Markdown
Collaborator

Part of #279 (PR 2/3)

This PR adds the missing scheme check to ActivityPubOAuth2Validator.validate_redirect_uri, and writes the redirect-scheme policy into settings/base.py instead of inheriting django-oauth-toolkit's invisible default.

The allowed list stays ['http', 'https'], so every redirect URI accepted today is still accepted.

validate_redirect_uri keeps super()'s allow-list check as the first gate, then tests the URI's scheme against oauth2_settings.ALLOWED_REDIRECT_URI_SCHEMES.

Returning False makes oauthlib raise InvalidRedirectURIError, a fatal client error, so DOT renders an error page rather than redirecting. A rejected URI is never used as a redirect target — no open-redirect surface.

@aaronjae22
aaronjae22 requested a review from lisad August 10, 2026 17:37
@aaronjae22 aaronjae22 self-assigned this Aug 10, 2026
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.

1 participant