Skip to content

[Due for payment 2025-05-14] [$250] Web - Contact methods - Validation opens when the link contains invalid contact method #58730

Closed

Description

@vincdargento

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.1.15-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to https://staging.new.expensify.com/settings/profile/contact-methods/invalidContactMethodName/details

Expected Result:

RHP will open not here page.

Actual Result:

RHP opens validation page for "invalidContactMethodName".

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021890532312750975518
  • Upwork Job ID: 1890532312750975518
  • Last Price Increase: 2025-04-03
Issue OwnerCurrent Issue Owner: @strepanier03

Activity

  1. added
    Bug
    Daily
    on Mar 19, 2025
  2. melvin-bot commented on Mar 19, 2025

    @melvin-bot

    Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. nkdengineer commented on Mar 19, 2025

    @nkdengineer
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-19 15:32:45 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    RHP opens validation page for "invalidContactMethodName".

    What is the root cause of that problem?

    We get contactMethod from the route

    const contactMethod: string = useMemo(() => {
    const contactMethodParam = route.params.contactMethod;

    And not has a condition to check the contactMethod is valid

    What changes do you think we should make in order to solve the problem?

    We can check if the contactMethod not includes in LoginLists or in personalDetailsList we will show the <NotFoundPage />

    Example we can use the function getPersonalDetailByEmail to check

        if(!getPersonalDetailByEmail(contactMethod)){
            return <NotFoundPage />;
        }
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can render the component with the mock route and verify that it's show not found page

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. bernhardoj commented on Mar 19, 2025

    @bernhardoj
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The invalid contact method still opens and show a validate code action input.

    What is the root cause of that problem?

    We already show a not found page if the contact method doesn't exist in LOGIN_LIST onyx data.

    if (!contactMethod || !loginData) {
    return (
    <ScreenWrapper testID={ContactMethodDetailsPage.displayName}>
    <FullPageNotFoundView
    shouldShow
    linkKey="contacts.goBackContactMethods"
    onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(backTo))}
    onLinkPress={() => Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(backTo))}
    />
    </ScreenWrapper>
    );
    }

    However, somehow after we visit the page with any contact method, the data is created. And it's because of this useEffect that reset the code sent state without checking first whether the contact method exist or not. It only checks whether it's already validated or not, which is false for non-existent contact.

    useEffect(() => {
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    if (loginData?.validatedDate || prevPendingDeletedLogin) {
    return;
    }
    resetContactMethodValidateCodeSentState(contactMethod);
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- The prevPendingDeletedLogin is a ref, so no need to add it to dependencies.
    }, [contactMethod, loginData?.validatedDate]);

    What changes do you think we should make in order to solve the problem?

    We need to early return if the contact method isn't found too.

    if (!loginData || loginData?.validatedDate || prevPendingDeletedLogin) {
        return;
    }
    

    optional, to cover a case where there is invalid login data on the onyx, we can improve the not found check by checking whether the login data has partnerUserID or not

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can render contact method details page with an invalid contact method as the route params and verify it shows the not found page.

  5. stephanieelliott commented on Mar 21, 2025

    @stephanieelliott
    Contributor

    Hey @vincdargento vincdargento, can this issue only be reproduced when accessing via a direct link? If so, how would users typically obtain that link in the first place?

  6. melvin-bot commented on Mar 24, 2025

    @melvin-bot

    @stephanieelliott Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  7. stephanieelliott commented on Mar 25, 2025

    @stephanieelliott
    Contributor

    Closing this, I think it's not something regular users wil run into

  8. bernhardoj commented on Mar 25, 2025

    @bernhardoj
    Contributor

    @stephanieelliott it allows the user to input any email, which means a user can use another user's email to request a magic code.

    1. User A visit the link with user B email
    2. User B email receives magic code which they don't request
  9. Pujan92 commented on Mar 26, 2025

    @Pujan92
    Contributor

    @stephanieelliott I think we should avoid user accessing this route for invalid contact method.

  10. stephanieelliott commented on Apr 2, 2025

    @stephanieelliott
    Contributor
  11. 47 remaining items

  12. melvin-bot commented on May 7, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.40-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-05-14. 🎊

    For reference, here are some details about the assignees on this issue:

    • @Pujan92 requires payment through NewDot Manual Requests
    • @bernhardoj requires payment through NewDot Manual Requests
  13. melvin-bot commented on May 7, 2025

    @melvin-bot

    @Pujan92 @strepanier03 @Pujan92 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  14. added
    Daily
    and removed
    Weekly
    on May 13, 2025
  15. melvin-bot commented on May 14, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@strepanier03)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1890532312750975518/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. Pujan92 commented on May 14, 2025

    @Pujan92
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/56487/files#r2088535550

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    1. Open an invalid contact method page (for example, https://staging.new.expensify.com/settings/profile/contact-methods/invalidContactMethodName/details)
    2. Verify that a not-found page is shown instead of a validation code screen

    Do we agree 👍 or 👎

  17. strepanier03 commented on May 15, 2025

    @strepanier03
    Contributor

    Payment summary

  18. strepanier03 commented on May 15, 2025

    @strepanier03
    Contributor

    Payment summary above @Pujan92 and @bernhardoj, you're all set to request. Closing this out and thank you both!

  19. bernhardoj commented on May 15, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  20. garrettmknight commented on May 20, 2025

    @garrettmknight
    Contributor

    $250 approved for @Pujan92

  21. JmillsExpensify commented on May 22, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions