fix(mobile): validate external redirect URLs#140
Open
dhairyashiil wants to merge 2 commits into
Open
Conversation
|
@dhairyashiil is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
24a90d8 to
633b73b
Compare
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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
Adds client-side validation for event-type success redirect URLs in the mobile app before create/update requests are submitted. The validator now mirrors the main web app schema for
successRedirectUrl: empty values are allowed,http://andhttps://URLs are allowed, and non-http schemes likejavascript:,data:, andftp:are rejected.Main web app parity
Checked
/Users/dhairyashilshinde/work/calcom/calonmain:packages/prisma/zod-utils.tsdefinessuccessRedirectUrlas empty string or a URL matching^http(s)?://.*.apps/web/modules/event-types/components/tabs/confirmation/event-confirmation-tab.tsxuses that redirect field and shows the approval warning flow.packages/features/eventtypes/lib/successRedirectUrlAllowed.tsandpackages/features/eventtypes/lib/getPublicEvent.tshandle paid-plan/grandfathering/approval filtering.So this mobile PR only rejects invalid/non-http URL schemes at the client boundary. It does not introduce a mobile-only HTTPS requirement.
Reviewer notes
http://redirect URLs, so mobile does too for consistency. If we want to require HTTPS, that should be changed centrally in the web/server schema first, then mobile can follow.Validation
bun --filter mobile test --runInBand utils/redirectUrlValidation.test.jsbun --filter mobile typecheckgit diff --check HEAD~1..HEAD