fix(auth): validate mobile OAuth redirect targets#358
Open
Ridanshi wants to merge 1 commit into
Open
Conversation
Collaborator
|
Please fix merge conflicts. |
9b60c95 to
4ab897c
Compare
|
@Ridanshi is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
CI — All Checks PassedBackend — PASS
Mobile — SKIP
Web — SKIP
Last updated: |
4ab897c to
c8e7e39
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.
Closes #299
Summary
Adds strict allowlist validation for OAuth
mobile_redirect_uritargets used during the mobile authentication flow.Previously, mobile redirect targets were not strictly validated against a configured allowlist, allowing attacker-controlled redirect destinations to potentially be introduced into the OAuth flow.
This PR hardens redirect-target handling while preserving the existing OAuth architecture, state validation, cookie validation, and normal web/mobile authentication behavior.
Security Issue
Without strict validation, malicious or malformed redirect targets could potentially:
The issue specifically affected mobile OAuth redirect handling.
Implementation
Added strict validation for
mobile_redirect_uriagainst the configured:Validation now occurs:
The implementation now rejects:
Existing OAuth state and cookie validation logic remains unchanged.
Files Changed
apps/backend/src/routes/auth.tsapps/backend/src/__tests__/auth.test.tsTests
Focused regression coverage added for:
Verification
Result:
Notes
This PR intentionally keeps scope limited to redirect-target validation for mobile OAuth flows.
No Firebase/auth middleware refactors, token generation changes, OAuth architecture rewrites, or unrelated cleanup were introduced.