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
Rules - Merchant Rule with special characters saved without error but disappeared later #81140
Version Number: V9.3.11-17 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#80853 Email or phone of affected tester (no customers):dreamnitethedragon+yydyd373@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redminote 10S Android 13 App Component: Workspace Settings
Action Performed:
Launch app
Create a workspace
Tap more features - Enable Rules
Tap Rules
Tap Add merchant rule
Enter a merchant
Enter merchant as <Shahrukh&bro> under apply these updates and save
Expected Result:
Merchant Rule saved with special characters must show invalid character error and must not allow to save the rule.
Actual Result:
Merchant Rule with special characters is saved without error but disappeared later.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #80853 - "Remove dev lock from merchant rules" by @luacmartins (High confidence) Related Issues: #80855 (feature enablement issue)
Recommendation: ROLL FORWARD
The issue should be fixed by adding proper client-side validation for special characters in merchant rule names. Reverting PR #80853 would simply hide the merchant rules feature again, which is not the desired outcome since this feature was intentionally enabled for release.
Labels: Keeping DeployBlockerCash (App deploy is blocked). Removing DeployBlocker if present (not a backend issue).
📋 Detailed Analysis
Evidence
PR #80853 enabled merchant rules for all users by changing the environment check from isDevelopment to isProduction. This exposed a pre-existing validation gap: the frontend allows merchant names with special characters (like &) to be entered and saved without validation, but the backend subsequently rejects them, causing the rule to disappear.
The frontend validation in src/components/Rule/TextBase.tsx only checks:
Required field fulfillment
Character length (max bytes)
There is no validation for special/invalid characters in merchant names.
The merchant rules feature was released without comprehensive input validation. When users enter merchant names with special characters like &, the frontend optimistically displays the rule as saved, but the backend silently rejects it (likely due to character encoding or SQL injection prevention), causing the rule to disappear from the UI.
The fix requires adding client-side validation to:
Validate allowed characters in merchant names before saving
Display clear error messages when invalid characters are entered
Prevent the form from being submitted with invalid data
Please re-state the problem that we are trying to solve in this issue.
Rules - Merchant Rule with special characters saved without error but disappeared later
What is the root cause of that problem?
The merchant‑rule input flows do not validate special characters at all. They only check required + length. So invalid data gets past the UI and the API rollback removes the optimistic rule, which looks like it “disappeared.”
What changes do you think we should make in order to solve the problem?
Add explicit client-side validation for invalid characters (minimal set: < and >) and reuse it across merchant‑rule inputs. This prevents invalid rules from being saved and avoids the “saved then disappears” behavior.
1. Add a shared validator for merchant‑rule characters
Activity
melvin-bot commentedon Feb 2, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #80853
melvin-bot commentedon Feb 2, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 2, 2026
Triggered auto assignment to @JmillsExpensify (
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.github-actions commentedon Feb 2, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon Feb 2, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #80853 - "Remove dev lock from merchant rules" by @luacmartins (High confidence)
Related Issues: #80855 (feature enablement issue)
Recommendation: ROLL FORWARD
The issue should be fixed by adding proper client-side validation for special characters in merchant rule names. Reverting PR #80853 would simply hide the merchant rules feature again, which is not the desired outcome since this feature was intentionally enabled for release.
Labels: Keeping
DeployBlockerCash(App deploy is blocked). RemovingDeployBlockerif present (not a backend issue).📋 Detailed Analysis
Evidence
PR #80853 enabled merchant rules for all users by changing the environment check from
isDevelopmenttoisProduction. This exposed a pre-existing validation gap: the frontend allows merchant names with special characters (like&) to be entered and saved without validation, but the backend subsequently rejects them, causing the rule to disappear.The frontend validation in
src/components/Rule/TextBase.tsxonly checks:There is no validation for special/invalid characters in merchant names.
Verification
src/pages/workspace/rules/MerchantRules/AddMerchantPage.tsx- uses RuleTextBase componentsrc/components/Rule/TextBase.tsx- contains only basic validation (required, length)src/libs/actions/Policy/Rules.ts- no client-side validation for special characters before API callsrc/pages/workspace/rules/MerchantRulesSection.tsxto change the feature flagRoot Cause
The merchant rules feature was released without comprehensive input validation. When users enter merchant names with special characters like
&, the frontend optimistically displays the rule as saved, but the backend silently rejects it (likely due to character encoding or SQL injection prevention), causing the rule to disappear from the UI.The fix requires adding client-side validation to:
luacmartins commentedon Feb 2, 2026
NAB feature is not available in prod.
marufsharifi commentedon Feb 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Rules - Merchant Rule with special characters saved without error but disappeared later
What is the root cause of that problem?
The merchant‑rule input flows do not validate special characters at all. They only check required + length. So invalid data gets past the
UIand theAPIrollback removes the optimistic rule, which looks like it “disappeared.”Root-cause code (current behavior):
App/src/pages/workspace/rules/MerchantRules/AddMerchantToMatchPage.tsx
Lines 66 to 74 in fb2838d
App/src/components/Rule/TextBase.tsx
Lines 44 to 52 in 5838890
What changes do you think we should make in order to solve the problem?
Add explicit client-side validation for invalid characters (minimal set:
<and>) and reuse it across merchant‑rule inputs. This prevents invalid rules from being saved and avoids the “saved then disappears” behavior.1. Add a shared validator for merchant‑rule characters
2. Allow rule text inputs to accept a custom validator
3. Enforce invalid‑character validation for “rename merchant”
4. Enforce invalid‑character validation for “merchant to match”
What alternative solutions did you explore? (Optional)
Alternative 1: Enable Strict HTML Tag Validation Flag
Add
shouldUseStrictHtmlTagValidationflag toFormProviderinTextBase.tsx.Benefit: Uses existing infrastructure, minimal code change.
Cons:
RuleTextBaseuses, not just merchant rules<...>pairs, not lone<or>(e.g., "ACME <" would pass)Chosen Solution: Custom
hasInvalidMerchantRuleCharacters()function is more targeted, catches ALL angle bracket cases, and has clear intent.luacmartins commentedon Feb 2, 2026
I'm working on this
luacmartins commentedon Feb 2, 2026
PR in review
luacmartins commentedon Feb 3, 2026
PR merged, we can close this.