Skip to content
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

[$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format #48407

Closed
6 tasks done
lanitochka17 opened this issue Sep 2, 2024 · 10 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 2, 2024

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: 9.0.27-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: N/A
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Taxes
  3. Add a tax rate with A: B as name and any rate
  4. Go to Search
  5. Click Filters
  6. Click Tax rate
  7. Select the tax rate with A: B name
  8. Click Save
  9. Click View results

Expected Result:

Search will not load infinitely

Actual Result:

Search loads infinitely when search filter has tax rate in A: B name format

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6590496_1725281171180.20240902_204541.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021831467372268005074
  • Upwork Job ID: 1831467372268005074
  • Last Price Increase: 2024-09-04
Issue OwnerCurrent Issue Owner: @rushatgabhane
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

Triggered auto assignment to @VictoriaExpensify (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.

@bernhardoj
Copy link
Contributor

bernhardoj commented Sep 2, 2024

Edited by proposal-police: This proposal was edited at 2023-10-06T12:00:00Z.

Proposal

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

Search loads infinitely when enter tax rate with A: B format.

What is the root cause of that problem?

When we create a tax rate with the name of A: B, the tax code becomes id_A:_B
image

Filtering tax code will filter based on the tax code and because it contains a colon :, the parser considered it as an AND operator.
image

And the BE will eventually return an error.
image

This happens if we filter based on other things too if we include : without a space.

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

We need to sanitize the string if it contains : just like we did when it contains a space or comma.

App/src/libs/SearchUtils.ts

Lines 411 to 416 in 9aca655

function sanitizeString(str: string) {
if (str.includes(' ') || str.includes(',')) {
return `"${str}"`;
}
return str;
}

The sanitation will wrap the keyword with ".

There is also another issue I notice where if we switch to inbox and then back to search, the issue happens again. To fix that, we need to also sanitize the string here.

filterValueString += ` ${filterName}${operatorToSignMap[queryFilter.operator]}${queryFilter.value}`;

filterValueString += ` ${filterName}${operatorToSignMap[queryFilter.operator]}${sanitizeString(queryFilter.value.toString())}`;

@melvin-bot melvin-bot bot added the Overdue label Sep 4, 2024
@VictoriaExpensify VictoriaExpensify added the External Added to denote the issue can be worked on by a contributor label Sep 4, 2024
Copy link

melvin-bot bot commented Sep 4, 2024

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

@melvin-bot melvin-bot bot changed the title Search - Search loads infinitely when search filter has tax rate in A: B name format [$250] Search - Search loads infinitely when search filter has tax rate in A: B name format Sep 4, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 4, 2024
Copy link

melvin-bot bot commented Sep 4, 2024

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

@VictoriaExpensify
Copy link
Contributor

Agree this is an issue and it should be fixed

@ghost
Copy link

ghost commented Sep 5, 2024

Edited by proposal-police: This proposal was edited at 2024-09-05 09:48:16 UTC.

Proposal

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

Certain characters, and sequences of characters, in the Name field of Taxes and categories like Merchants cause the search/filter to load indefinitely, along with other issues such as displaying of the filtered term.

What is the root cause of that problem?

Input for the Name field is insufficiently validated, and only slightly sanitized for spaces and commas.

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

Validate input for the Name field. More concretely, reject input with malicious characters, malicious character sequences, and most characters that break search/filter. Sanitize a limited set of non malicious characters, like comma and blank space, and ensured they display correctly.

What alternative solutions did you explore? (Optional)

@trjExpensify
Copy link
Contributor

Moving to wave-control, as it's search related. CC: @luacmartins for vis

@luacmartins luacmartins self-assigned this Sep 5, 2024
@luacmartins luacmartins changed the title [$250] Search - Search loads infinitely when search filter has tax rate in A: B name format [$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format Sep 5, 2024
@luacmartins
Copy link
Contributor

I think this may be solved once we update the syntax grammar in this PR

@luacmartins luacmartins removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 5, 2024
@luacmartins luacmartins changed the title [$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format [HOLD][$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format Sep 5, 2024
@luacmartins luacmartins changed the title [HOLD][$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format [HOLD 47789][$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format Sep 5, 2024
@luacmartins luacmartins added the Reviewing Has a PR in review label Sep 6, 2024
@luacmartins luacmartins changed the title [HOLD 47789][$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format [$250] [Search v2.1] Search loads infinitely when search filter has tax rate in A: B name format Sep 6, 2024
@luacmartins
Copy link
Contributor

This is being solved here

@VictoriaExpensify
Copy link
Contributor

Closing this out since this has been solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
Archived in project
Development

No branches or pull requests

6 participants