You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-07-12] [$1000] emojis are accepted in card name, debit card form field. #21255
Enter name with emojis on card name form field.
for eg : " John ❤️😄😄" .
Notice it doesn't throw any error.
Expected Result:
inconsistecny in "Legal Name" and "Card Name" form field.
i.e in legal name emojis and special characters aren't allowed. whereas card name form field doesn't check emojis.
Actual Result:
Emojis are allowed in card name field.
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?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.30-0 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
What changes do you think we should make in order to solve the problem?
Modify ALPHABETIC_CHARS to have anchors (and also a space and accented characters), eg: ALPHABETIC_CHARS: /^[a-zA-ZÀ-ÿ ]*$/,
This way it matches ALPHABETIC_CHARS_WITH_NUMBER, but without numbers.
What alternative solutions did you explore? (Optional)
We should remove isValidCardName as ALPHABETIC_CHARS is a wrong regex and allows emoji etc. Moreover, we should rename isValidLegalName to isValidName to make it generic and usable in multiple places.
We should also remove ALPHABETIC_CHARS as it is wrong and not used at any other place.
What alternative solutions did you explore? (Optional)
changed the title [-]emojis are accepted in card name, debit card form field.[/-][+][$1000] emojis are accepted in card name, debit card form field.[/+]on Jun 22, 2023
Please re-state the problem that we are trying to solve in this issue.
emojis are accepted in card name, debit card form field
What is the root cause of that problem?
The regex for Card Name is not checking for errors.
What changes do you think should make in order to solve the problem?
we should throw an error whenever the user enters an emoji in the input field. To achieve this we can add an emoji check where we are validating. We already have an emojis regex in CONST.js we can use it to validate Bank name input field
here add another check || CONST.REGEX.EMOJIS.test(nameOnCard)
In this way we are not messing up with already created regex. We can also add this check in address field that is also accepting emojis
Results
Screen.Recording.2023-06-24.at.12.19.23.AM.mov
What alternative solutions did you explore? (Optional)
A discussion in #expensify-bugs 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 - no discussions
Determine if we should create a regression test for this bug - we are good with QA steps in current issue
The PR that introduced the bug has been identified. Link to the PR: #21880
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 - no comments were addressed
That wasn't the PR that introduced the bug was it? 😕
A discussion in #expensify-bugs 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 - no discussions
On this one, I actually wonder if there's something we could be doing better to ensure emojis don't slip through the net on fields that have input restrictions. Did you consider that, such that we can potentially limit this type of bug report in the future perhaps?
Determine if we should create a regression test for this bug - we are good with QA steps in current issue
As for this, I think we can modify the existing test script to accommodate a check for the name field in addition. I've gone ahead and created an issue for Applause for that edit.
Error tests and add second debit card
Navigate to the add debit card page
Without entering any data, click on the save button
Verify all the required fields show an error informing the user of the required information
Verify all errors are related to the missing info
On the Name field - enter an invalid name (e.g John 😄 ❤️ )
Verify there's an error indicating that the name can only include latin letters and numbers.
On the Expiration date - enter a invalid date (e.g 1111)
Verify there's an error indicating the user to enter a valid date
Fill each field with random valid data
Verify the errors are removed after entering valid data on each field
Verify the error above the "Save" button is removed after fixing each field
Add a secondary debit card - For the debit card number, use any from this list Sandbox Cards
Activity
melvin-bot commentedon Jun 21, 2023
Triggered auto assignment to @isabelastisser (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jun 21, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)Ollyws commentedon Jun 21, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Emojis are accepted for card name.
What is the root cause of that problem?
The ALPHABETIC_CHARS regex isn't using any anchors, but in ALPHABETIC_CHARS_WITH_NUMBER we do use the anchors
^and$.What changes do you think we should make in order to solve the problem?
Modify
ALPHABETIC_CHARSto have anchors (and also a space and accented characters), eg:ALPHABETIC_CHARS: /^[a-zA-ZÀ-ÿ ]*$/,This way it matches ALPHABETIC_CHARS_WITH_NUMBER, but without numbers.
What alternative solutions did you explore? (Optional)
None
Nikhil-Vats commentedon Jun 21, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Emojis are accepted for card name in
AddDebitCardPage.What is the root cause of that problem?
We have two different functions for validating legal name and card name.
App/src/libs/ValidationUtils.js
Lines 148 to 154 in 9e8a151
App/src/libs/ValidationUtils.js
Lines 376 to 379 in 9e8a151
What changes do you think we should make in order to solve the problem?
We should remove one of the functions and use the other function in both places -
We should remove
isValidCardNameasALPHABETIC_CHARSis a wrong regex and allows emoji etc. Moreover, we should renameisValidLegalNametoisValidNameto make it generic and usable in multiple places.We should also remove
ALPHABETIC_CHARSas it is wrong and not used at any other place.What alternative solutions did you explore? (Optional)
NA
[-]emojis are accepted in card name, debit card form field.[/-][+][$1000] emojis are accepted in card name, debit card form field.[/+]melvin-bot commentedon Jun 22, 2023
Job added to Upwork: https://www.upwork.com/jobs/~016b95ce0b884de115
melvin-bot commentedon Jun 22, 2023
Current assignee @isabelastisser is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jun 22, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @narefyev91 (
External)Nodebrute commentedon Jun 23, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
emojis are accepted in card name, debit card form field
What is the root cause of that problem?
The regex for Card Name is not checking for errors.
What changes do you think should make in order to solve the problem?
we should throw an error whenever the user enters an emoji in the input field. To achieve this we can add an emoji check where we are validating. We already have an emojis regex in CONST.js we can use it to validate Bank name input field
here add another check || CONST.REGEX.EMOJIS.test(nameOnCard)
In this way we are not messing up with already created regex. We can also add this check in address field that is also accepting emojis
Results
Screen.Recording.2023-06-24.at.12.19.23.AM.mov
What alternative solutions did you explore? (Optional)
35 remaining items
PauloGasparSv commentedon Jul 12, 2023
Not overdue, bump @narefyev91 @trjExpensify @isabelastisser
narefyev91 commentedon Jul 12, 2023
trjExpensify commentedon Jul 12, 2023
👋 @narefyev91
That wasn't the PR that introduced the bug was it? 😕
Nikhil-Vats commentedon Jul 12, 2023
@narefyev91 @trjExpensify this is the PR that introduced the bug.
narefyev91 commentedon Jul 12, 2023
Yup already linked that #6845
trjExpensify commentedon Jul 12, 2023
Okay cool, and did you comment on the PR for the benefit of its authors to close the feedback loop?
trjExpensify commentedon Jul 12, 2023
On this one, I actually wonder if there's something we could be doing better to ensure emojis don't slip through the net on fields that have input restrictions. Did you consider that, such that we can potentially limit this type of bug report in the future perhaps?
As for this, I think we can modify the existing test script to accommodate a check for the name field in addition. I've gone ahead and created an issue for Applause for that edit.
isabelastisser commentedon Jul 12, 2023
Offers sent in Upwork to @Nikhil-Vats and @ashimsharma10, please accept it and I will send the payment.
@narefyev91 I can't find you in Upwork, what's your profile?
narefyev91 commentedon Jul 12, 2023
@isabelastisser no worries - I'm from Callstack - and no needs to pay inside Upwork
Nikhil-Vats commentedon Jul 12, 2023
@isabelastisser offer accepted.
isabelastisser commentedon Jul 12, 2023
The payments are processed in Upwork, we should be all set!