-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: prevent signing in to wrong account in the desktop app via magic link #24207
Conversation
src/libs/actions/App.js
Outdated
@@ -341,12 +341,18 @@ function openProfile(personalDetails) { | |||
} | |||
|
|||
function beginDeepLinkRedirect() { | |||
// Match any magic link (/v/<account id>/<6 digit code>) | |||
const isMagicLink = /\/v\/\w+\/[0-9]{6}/.test(window.location.pathname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use CONST.REGEX.ROUTES.VALIDATE_LOGIN
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done!
Reviewer Checklist
Screenshots/VideosWeb + desktopdesktop3-compressed.mp4Mobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change apart from what @s77rt pointed out
Lost a couple comments when we moved that line, so @JKobrynski take a look at #24207 (comment) (though I don't know if we need to do that?). As for the |
src/libs/actions/App.js
Outdated
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates wheather default authentication method (shortLivedAuthToken) should be used | ||
*/ | ||
function beginDeepLinkRedirectAfterTransition(shouldAuthenticateWithCurrentAccount = true) { | ||
waitForSignOnTransitionToFinish().then(beginDeepLinkRedirect(shouldAuthenticateWithCurrentAccount)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waitForSignOnTransitionToFinish().then(beginDeepLinkRedirect(shouldAuthenticateWithCurrentAccount)); | |
waitForSignOnTransitionToFinish().then(() => beginDeepLinkRedirect(shouldAuthenticateWithCurrentAccount)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeMobile Web - SafariDesktopdesktop.mp4iOSAndroid |
@JKobrynski Please complete the checklist (the author checklist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry one typo, then good to go!
src/libs/actions/App.js
Outdated
function beginDeepLinkRedirectAfterTransition() { | ||
waitForSignOnTransitionToFinish().then(beginDeepLinkRedirect); | ||
/** | ||
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates wheather default authentication method (shortLivedAuthToken) should be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates wheather default authentication method (shortLivedAuthToken) should be used | |
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates whether default authentication method (shortLivedAuthToken) should be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/libs/actions/App.js
Outdated
@@ -416,13 +416,18 @@ function openProfile(personalDetails) { | |||
); | |||
} | |||
|
|||
function beginDeepLinkRedirect() { | |||
/** | |||
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates wheather default authentication method (shortLivedAuthToken) should be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates wheather default authentication method (shortLivedAuthToken) should be used | |
* @param {boolean} shouldAuthenticateWithCurrentAccount Optional, indicates whether default authentication method (shortLivedAuthToken) should be used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Oh and please run And is there a way to sign your commits? I confess I don't fully know what that means haha; maybe @s77rt has an idea? |
@dangrous Signed commits are just to prove that you are the real person who made those commits as I think it's pretty easy to impersonate others. |
Addressed the newest comments, signed the latest commits |
Code looks good! It's still having trouble with some of the commits; is there a way to go back and sign these? The two you just pushed seem okay, but the ones before.
Looks like there are a couple resources online that explain how to do this. Sorry for the trouble! |
2e67fc2
to
08447b8
Compare
@dangrous commits have been signed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for getting that sorted!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 1.3.56-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|
Details
Fixed Issues
$ #23409
PROPOSAL: #23409 (comment)
Tests
Disclaimer
This is a desktop only issue that is not reproductible on mobile, therefore there are no testing steps or screen recordings on mobile.
Offline tests
QA Steps
Same as "Tests" section above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web + desktop
desktop3-compressed.mp4
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android