-
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
Web - Log in -2FA occur when using expired magic code link with modified characters #53404
Comments
Triggered auto assignment to @twisterdotcom ( |
Edited by proposal-police: This proposal was edited at 2024-12-03 03:54:18 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.2FA occur when using expired magic code link with modified characters What is the root cause of that problem?We go to the magic link, change the validation code to the wrong format, and then call this
When we call So this condition will be valid, and the two-factor authentication page will be displayed
What changes do you think we should make in order to solve the problem?Because the frontend sends the validation code in the wrong format to the backend, the response returns an incorrect value. We must validate the code before sending it to the backend, and it will show a 'not found' page, as it did previously (if the validation code is wrong, the 'not found' page will be displayed). //src/pages/ValidateLoginPage/index.website.tsx#L35
useEffect(() => {
if (isUserClickedSignIn) {
// The user clicked the option to sign in the current tab
Navigation.isNavigationReady().then(() => {
Navigation.goBack();
});
return;
}
Session.initAutoAuthState(autoAuthStateWithDefault);
if (!shouldStartSignInWithValidateCode) {
if (exitTo) {
Session.handleExitToNavigation(exitTo);
}
return;
}
+ if (!ValidationUtils.isValidValidateCode(validateCode)) {
+ return;
+ }
// The user has initiated the sign in process on the same browser, in another tab.
Session.signInWithValidateCode(Number(accountID), validateCode);
// Since on Desktop we don't have multi-tab functionality to handle the login flow,
// we need to `popToTop` the stack after `signInWithValidateCode` in order to
// perform login for both 2FA and non-2FA accounts.
desktopLoginRedirect(autoAuthStateWithDefault, isSignedIn);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []); POCScreen.Recording.2024-12-03.at.10.53.19.movWhat alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Key Fixes: 1. Validate Code LengthAdded a check to ensure the magic code is of the expected length.
This is placed inside the first useEffect block that initializes the authentication state. 2. Validate ExpirationAdded a check to verify if the code has expired.
This ensures the code is not only unmodified but also not expired. It is placed right after the magic code length check. 3. Updated State for Failed ValidationSet the FAILED state when the link is invalid or expired.
This is used in both the length and expiration checks. What is the root cause of that problem?Key Changes:
src/pages/ValidateLoginPage/index.website.tsx
|
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v9.0.69-4
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
change a single character > https://staging.new.expensify.com/v/7453760/1238**
Expected Result:
As the link is already expired and the link character is modified the link should not lead to 2FA page
Actual Result:
2FA occur when using expired magic code link with modified characters
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6679597_1733170971918.bandicam_2024-12-02_23-15-36-518.mp4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: