Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[HOLD #17387] [$1000] Group chat created even if there is an invalid email id and Error occurs after sending first message #18181

Closed kavimuru closed 9 months ago

kavimuru commented 1 year ago

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


Action Performed:

  1. Create a new group chat
  2. Add an invalid email id (an email id with more than 64 characters for the email - not including the domain) eg ganache-tasacks.0z+randomlongtexttoreachsomecharactersneedsommore@icloud.com
  3. Add few more valid emails (eg ganache-tacks.0z+randomlongtexttoreachsomecharactersneedsommore@icloud.com, ganache-tacks.0z+randomlongtexttor3eachsomecharactersneedsomemo_@icloud.com and ganache-tacks.0z+randomlongtexttoreachsomecharactersneedsomemo_@icloud.com)
  4. Create group

Expected result:

It should throw an error while creating group.

Actual result:

Group chat is created and error occurs after sending the first message.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: 1.3.8 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/43996225/235267411-88b4e1c6-6e47-493a-8c80-7118d5985cf7.mov

https://user-images.githubusercontent.com/43996225/235267422-0cccac63-f134-4e12-8524-18b8864efe33.mp4

Expensify/Expensify Issue URL: Issue reported by: @shivansh9007 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682670612672119

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e9bb14ea353bc37e
  • Upwork Job ID: 1653836331831513088
  • Last Price Increase: 2023-05-10
MelvinBot commented 1 year ago

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

MelvinBot commented 1 year ago

Bug0 Triage Checklist (Main S/O)

jayeshmangwani commented 1 year ago

@kavimuru I have reported a similar bug before https://expensify.slack.com/archives/C049HHMV9SM/p168231323463581911, can you please check this

kavimuru commented 1 year ago

@jayeshmangwani I was not able to reproduce your bug. Also it was not mentioned in the bug report that invalid email for one of the user.

MelvinBot commented 1 year ago

@adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

MelvinBot commented 1 year ago

@adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

adelekennedy commented 1 year ago

Agree it should throw an error while creating the group - let's make it external

MelvinBot commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~01e9bb14ea353bc37e

MelvinBot commented 1 year ago

Current assignee @adelekennedy is eligible for the External assigner, not assigning anyone new.

MelvinBot commented 1 year ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

MelvinBot commented 1 year ago

Triggered auto assignment to @Beamanator (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

adelekennedy commented 1 year ago

Looks workable to me!

alexrasla commented 1 year ago

Proposal

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

In this problem, we are able to add email ids that have more than 64 characters when creating a New Group.

What is the root cause of that problem?

The root cause of the problem is the fact that the isValidEmailfunction in node_modules/expensify-common/lib/str.js does not check for email ids that are > 64 characters. The function only checks that the string parameter has valid email characters and an @ sign through regular expressions.

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

The change I would make to solve this is simply checking if the email is less than or equal to 64 characters in the isValidEmail function. This would produce the Invalid email error as shown below so the user would never be able to add the email address to the group.

Screenshot 2023-05-03 at 8 24 14 PM

Screenshot 2023-05-03 at 8 00 03 PM

What alternative solutions did you explore? (Optional)

An alternative solution I explored is checking that all the emails are less than 64 characters within the navigateToAndOpenReport function. However, I believe this solution is worse because email addresses can never be more than 64 characters, as per the accepted email address standards

Screenshot 2023-05-03 at 8 25 33 PM

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.

MelvinBot commented 1 year ago

📣 @alexrasla! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
alexrasla commented 1 year ago

Contributor details Your Expensify account email: alex.rasla@me.com Upwork Profile Link: https://www.upwork.com/freelancers/~0197c9436d4d7508f2

MelvinBot commented 1 year ago

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

mollfpr commented 1 year ago

Thanks @alexrasla, for the proposal. To catch that email limit character, I'd prefer to fix the regex CONST.REG_EXP.EMAIL. The standard limited the username to 64 characters and the domain name to 255 characters. So not just limit the string before the domain, but also limit the character after the domain name.

aimane-chnaif commented 1 year ago

We're going to fix all email validation inconsistency issues (frontend vs backend, chat vs search vs login vs contact, etc) in one GH - https://github.com/Expensify/App/issues/17387#issuecomment-1534783224

alexrasla commented 1 year ago

Should I edit my proposal and submit it there then, or has a proposal already been accepted for that issue?

alexrasla commented 1 year ago

Proposal

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

In this problem, we are able to add email ids that have more than 64 characters when creating a New Group.

What is the root cause of that problem?

The root cause of the problem is the fact that the EMAIL_BASE_REGEX regular expression constant in node_modules/expensify-common/lib/CONST.jsx does not check for character limits for email ids and domains. The constant only checks that the compared string has valid email characters and an @ sign through regular expressions.

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

The change I would make to solve this is simply changing the EMAIL_BASE_REGEX to check if the email id is less than or equal to 64 characters in the regular expression. This would produce the Invalid email error as shown below so the user would never be able to add the email address to the group. The values of the length of the domain before and after the . are standards that I found online, but those can be easily changed to just have a 255 limit for the entire part after the @

Screenshot 2023-05-04 at 9 24 39 AM

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.

chiragxarora commented 1 year ago

@mollfpr I had looked at various sources before reporting the original bug here, that the limit of email address is not 320 but 254. The standards had been revised in past which corrected it from 320 to 254. reference: https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address

Beamanator commented 1 year ago

Not overdue, proposals still being reviewed 👍

mollfpr commented 1 year ago

@Beamanator We could fix the email validation issue all in one place like @aimane-chnaif says https://github.com/Expensify/App/issues/18181#issuecomment-1535013276.

Beamanator commented 1 year ago

Oooooooo that's delightful 👍 So do you think that means we can close this one out?

mollfpr commented 1 year ago

@Beamanator Yes, but let's wait a little bit longer. The new GH issue still needs to be created.

melvin-bot[bot] commented 1 year ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

adelekennedy commented 1 year ago

Are we still waiting for the new GH issue?

mollfpr commented 1 year ago

@adelekennedy Yes!

melvin-bot[bot] commented 1 year ago

@Beamanator @mollfpr @adelekennedy this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

chiragxarora commented 1 year ago

Aren't we fixing all email validation errors in other issue?

aimane-chnaif commented 1 year ago

All email validation issues are handled in https://github.com/Expensify/App/issues/17387

chiragxarora commented 1 year ago

was wondering why this issue is still open and which new GH are we waiting for

Are we still waiting for the new GH issue?

mollfpr commented 1 year ago

@adelekennedy @Beamanator Could one of you add HOLD to the title? We can validate again this issue after mentioned issue.

Beamanator commented 1 year ago

Thanks @mollfpr ! Put on hold for https://github.com/Expensify/App/issues/17387 👍

adelekennedy commented 1 year ago

not overdue - this is on hold

adelekennedy commented 1 year ago

on hold - not reassigning

mollfpr commented 1 year ago

Still on hold

mollfpr commented 1 year ago

Still on hold

adelekennedy commented 1 year ago

still on hold!

adelekennedy commented 1 year ago

Still on hold

melvin-bot[bot] commented 1 year ago

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

adelekennedy commented 1 year ago

Still holding

adelekennedy commented 1 year ago

Still on hold!

adelekennedy commented 1 year ago

hold

Beamanator commented 1 year ago

still on hold but seems like issue we're holding on has some progress

adelekennedy commented 12 months ago

still holdin on!

Beamanator commented 11 months ago

held issue is closed! can we close this one out too??

Beamanator commented 9 months ago

I think we can close this out 👍

melvin-bot[bot] commented 9 months ago

📣 @shivansh-nathani! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>