-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Due for payment 2025-04-28] [$250] Unable to save search query name that contains before and after dates #59283
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
Comments
Triggered auto assignment to @twisterdotcom ( |
proposal by @dominictb ProposalPlease re-state the problem that we are trying to solve in this issue.Cannot save search query name that contains before and after date What is the root cause of that problem?When saving the search, we validate using logics here: App/src/components/Form/FormProvider.tsx Line 116 in da9797b
There's a part where we check if the string contains html tags: App/src/components/Form/FormProvider.tsx Lines 142 to 160 in da9797b
Looking at the query name here: type:expense status:all date<2025-03-13 date>2025-03-12 We see there's a part here: <2025-03-13 date> This part will match VALIDATE_FOR_HTML_TAG_REGEX: Line 1695 in da9797b
But it's not one of the whitelisted HTML tags: https://github.com/Expensify/App/blob/main/src/CONST.ts#L1704 So the conditions here will not be returned early: App/src/components/Form/FormProvider.tsx Lines 145 to 157 in da9797b
And error is shown App/src/components/Form/FormProvider.tsx Line 160 in da9797b
What changes do you think we should make in order to solve the problem?The regex used to check for HTML here is good, but it leaves some false positive cases like the one above, while fails to match some tags like this one: I found a regex on this blog post that works pretty well in this case: /</?\w*((\s+\w+(\s*=\s*(?:"(.|\n)?"|'(.|\n)?'|[^'">\s]+))?)+\s*|\s*)/?>/g We should apply this regex to VALIDATE_FOR_HTML_TAG_REGEX, and based on the comments on the constant, we should update BE as well. What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Create unit test to test for possible HTML tags with VALIDATE_FOR_HTML_TAG_REGEX What alternative solutions did you explore? (Optional)Or we can pass allowHTML to FormProvider to ignore the check. |
Repost my proposal here due to formatting issue ProposalPlease re-state the problem that we are trying to solve in this issue.Cannot save search query name that contains before and after date What is the root cause of that problem?When saving the search, we validate using logics here: App/src/components/Form/FormProvider.tsx Line 116 in da9797b
There's a part where we check if the string contains html tags: App/src/components/Form/FormProvider.tsx Lines 142 to 160 in da9797b
Looking at the query name here:
We see there's a part here:
This part will match Line 1695 in da9797b
But it's not one of the whitelisted HTML tags: https://github.com/Expensify/App/blob/main/src/CONST.ts#L1704 So the conditions here will not be returned early: App/src/components/Form/FormProvider.tsx Lines 145 to 157 in da9797b
And error is shown App/src/components/Form/FormProvider.tsx Line 160 in da9797b
What changes do you think we should make in order to solve the problem?The regex used to check for HTML here is good, but it leaves some false positive cases like the one above, while fails to match some tags like this one:
I found a regex on this blog post that works pretty well in this case:
We should apply this regex to What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Create unit test to test for possible HTML tags with What alternative solutions did you explore? (Optional)Or we can pass |
ProposalPlease re-state the problem that we are trying to solve in this issue.Unable to save search query name that contains before and after dates What is the root cause of that problem?App/src/components/Form/FormProvider.tsx Lines 142 to 143 in 3bfb30a
currently Line 1704 in 3bfb30a
we have not added tag regarding date in What changes do you think we should make in order to solve the problem?We should add Line 1704 in 3bfb30a
to WHITELISTED_TAGS: [/<>/, /< >/, /<->/, /<-->/, /<br>/, /<br\/>/, /[<>]\d{4}-\d{2}-\d{2}/],
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?N/A 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. |
Job added to Upwork: https://www.upwork.com/jobs/~021905581416164321466 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak ( |
@eVoloshchak Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@dominictb's proposal:
Saying all that, I still think this is the correct approach. 🎀👀🎀 C+ reviewed! |
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@marcaaron gentle bump #59283 (comment) |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@marcaaron Huh... This is 4 days overdue. Who can take care of this? |
📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
I think it's fine to update this on the FE for now. @eVoloshchak did you test this out and confirm that the WAF will strip this value? |
@marcaaron Sorry the confusion but for the FE part I proposed adding another tag (tested with WAF using multiple queries) and @eVoloshchak is mentioned that here
@eVoloshchak Would you mind confirming here please |
No confusion here. @dominictb you may begin. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.30-4 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-04-28. 🎊 For reference, here are some details about the assignees on this issue:
|
@eVoloshchak / @dominictb @twisterdotcom @eVoloshchak / @dominictb 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] |
After updating the regex, we can now enter |
@marcaaron is :this: something quick, or should I lobby in #engineering for somebody to do it? |
Personally, I don't think that's something we need to urgently address. Mostly, I can't think of why we want to support setting |
Fair point. Is that the only failure the backend will block now @bernhardoj? If so, I agree with @marcaaron it's not really a problem. |
It will fail for |
The issue is when using special characters between web.mp4 |
Okay, I agree it's less obvious but I am happy for us to leave this bug in prod and fix it when the first cyborg/gen z kid named |
Payment Summary:
|
Uh oh!
There was an error while loading. Please reload this page.
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: 9.1.20-1
Reproducible in staging?: Y
Reproducible in production?:
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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
Expensify/Expensify Issue URL:
Issue reported by: @dominictb
Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Expected Result:
Should save successfully
Actual Result:
“Invalid character.” Error shows up
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Screen.Recording.2025-03-27.at.22.06.33.mov
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @marcaaronThe text was updated successfully, but these errors were encountered: