Repository navigation
Reject blank-rendering display names via invisible-char-aware validation - #96468
Conversation
Co-authored-by: Maria D'Costa <MariaHCD@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
The only failing check is PR Author Checklist / checklist, and there is nothing for me to fix in code — every real check passes. Why it's failing: the Everything else is green: typecheck, Bun tests, all Next step (human co-author): complete the PR Author Checklist boxes and replace the |
|
The only failing check is PR Author Checklist / checklist, and it's not a code problem — there's nothing for me to fix or push. It fails because the checklist boxes in the PR description aren't ticked:
This one requires the human author to review and check each box — it can't (and shouldn't) be auto-filled. Once you tick the boxes in the PR description, the check re-runs and goes green. Everything else is passing: Bun tests, ESLint, Oxfmt, typecheck, all Action needed: complete the PR Author Checklist in the description to clear the failing check. |
|
The only failing check on this PR is PR Author Checklist / checklist — every other check passes ( This one isn't a code failure I can push a fix for: the PR Author Checklist workflow fails until the author checklist boxes in the PR description are ticked, which is a human step. Since I opened this PR as a bot, the checkboxes need to be completed by a person (e.g. the assignee) verifying the manual test steps and platform testing before it can pass. No code change is warranted here — there's nothing broken in the branch. To clear the check, complete the PR Author Checklist items in the description. |
|
@gijoe0295 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
There are no failing checks to fix on this PR right now. The Nothing to push — once the |
mountiny
left a comment
There was a problem hiding this comment.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
- I verified tests pass on all platforms & I tested again on:
- Android: HybridApp
- Android: mWeb Chrome
- iOS: HybridApp
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
- If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
Screenshots/Videos
Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.49-0 🚀
|
|
🤖 I reviewed the changes in this PR against Expensify's help site content under Why: This PR is an internal validation-hardening fix. It makes the Display name field reject inputs that are composed only of blank-rendering invisible characters (e.g. Braille Pattern Blank The only help article that touches this area — How to update your display name — only explains how to edit your display name (Account > Profile > Display Name). It does not document display-name validation rules, so it remains accurate and doesn't need an update. Since no docs changes are needed, I did not open a draft help site PR. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.49-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The "Display Name" setting enforced a "required" check on the first name field with a raw length comparison (
values.firstName.length === 0). This let a user save an all-invisible first name (e.g.U+200BZero Width Space) that renders as a blank profile name.The two characters called out in the report (
U+200B, plain space) are already caught onmain, becauseFormProviderrunsStringUtils.removeInvisibleCharactersbeforevalidate()sees the value. The remaining gap is blank-rendering characters that are not in the\p{C}/\p{Z}Unicode groups and so slip through today — e.g. Braille Pattern Blank (U+2800, category So) and the Hangul fillers (U+115F,U+1160,U+FFA0, category Lo). Those save a blank-looking display name.This PR closes that gap with two layers:
Harden the field check — in
DisplayNamePage.tsxvalidate(), replace the rawvalues.firstName.length === 0with!isRequiredFulfilled(values.firstName)(from@libs/ValidationUtils).isRequiredFulfilleddelegates toStringUtils.isEmptyString, the invisible-char-aware emptiness check. This keeps the page correct even if form trimming is ever disabled, and is the semantically correct helper.Close the class of bug — extend
CONST.REGEX.OTHER_INVISIBLE_CHARACTERSto also coverU+115F,U+1160,U+FFA0, andU+2800.StringUtils.isEmptyStringandremoveInvisibleCharactersalready consume this constant, so both validation and submission pick up the new code points automatically and every form benefits. The list is kept conservative — only code points that render blank/zero-advance — to avoid rejecting legitimate names. Verified none of these code points appear in the emoji assets.Added unit tests to
tests/unit/isEmptyString.tsandtests/unit/removeInvisibleCharacters.tsasserting the new blank glyphs are treated as empty.Scope is App-only and self-scoped (a user's own display name); no backend change is needed. Consistent with the Low severity assessment on the issue.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/661474
PROPOSAL: https://github.com/Expensify/Expensify/issues/661474#issuecomment-5021069036
Tests
Setup: you need a few blank-rendering characters on the clipboard. Copy them from between the pipes below (each pipe pair contains exactly one character):
U+2800: |⠀|U+3164: |ㅤ|U+FFA0: |ᅠ|U+200B: ||Blank first name is rejected
U+2800) into it — the field will look empty but the Save button is enabled.U+3164,U+FFA0,U+200B) and for a combination of several of them pasted together — verify the same error appears every time.Valid names still save
7. In "First name" type a normal name (e.g.
Maria), leave "Last name" empty, and tap Save.8. Verify the page closes with no error and the new display name shows on the Profile page, in the LHN header, and on your own messages in a chat.
9. Open Display name again, enter a first name that contains a blank glyph next to real letters (e.g. paste
U+2800then typeMaria) and Save.10. Verify it saves — only fully-blank input is rejected; a name with at least one visible character is still allowed.
Last name is unaffected
11. Set "First name" to a normal name and paste a blank glyph into "Last name", then Save.
12. Verify it saves without an error — "Last name" is optional and this PR does not change that.
Regressions in other invisible-character-aware flows
13. Open any chat, type a message that is only a Braille Pattern Blank (
U+2800) and press Enter — verify nothing is sent (the empty-message behavior is unchanged).14. Send a normal message containing emojis (e.g.
Hello 👋🏽 👨👩👧👦) and verify the emojis still render correctly and are not stripped.Unit tests
15. Run
npm run test -- tests/unit/isEmptyString.ts tests/unit/removeInvisibleCharacters.tsand verify all tests pass.Offline tests
U+2800) into "First name" and tap Save.QA Steps
Setup: copy the blank-rendering characters from between the pipes below (each pipe pair contains exactly one character):
U+2800: |⠀|U+3164: |ㅤ|U+FFA0: |ᅠ|U+200B: ||U+2800) — the field looks empty.U+3164,U+FFA0,U+200B, a plain space, and a combination of several of them — verify the same error appears each time.Maria) and tap Save.U+2800followed by a normal name (e.g.Maria) and Save — verify it saves, because the field contains visible characters.U+2800— verify nothing is sent.Hello 👋🏽 👨👩👧👦) — verify emojis still render correctly and are not stripped.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
Screen.Recording.2026-08-03.at.7.32.11.PM.mov