Skip to content

upgrade: bump expensify-common to 2.0.224 to enforce URL hostname length limits - #104791

Merged
JS00001 merged 4 commits into
Expensify:mainfrom
Uzaifm127:upgrade/102500-expensify-common
Nov 3, 2026
Merged

JS00001 merged 4 commits into
Expensify:mainfrom
Uzaifm127:upgrade/102500-expensify-common

Conversation

@Uzaifm127

@Uzaifm127 Uzaifm127 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

This PR upgrades expensify-common from 2.0.211 to 2.0.224 to bring the URL hostname validation from expensify-common #951 and the follow-up changes from expensify-common #966 into App.

Before this upgrade, ExpensiMark could turn an oversized hostname into a link. The URL then appeared in both the link destination and its visible text, so a message with fewer than 15,000 characters in the composer could exceed the backend's 15,000-character limit after parsing.

The updated parser checks both DNS hostname limits: 63 ASCII characters per label and 253 ASCII characters for the complete hostname. Hostnames exceeding either limit stay plain, including long dotted hostnames. The protocol, port, path, query, and fragment are excluded from the hostname length.

The follow-up PR prevents a valid-looking domain inside an oversized hostname from becoming a partial link. It also preserves the original email context during URL matching, so rejecting an oversized email domain doesn't expose the part before @ as a website link or leave the remainder styled as a mention. Separate valid URLs and normal email addresses continue to become links.

Fixed Issues

$ #102500
PROPOSAL:

Tests

Test 1: Hostname label length

  1. Open the App and open any chat.

  2. Paste the following hostname, whose first label has 63 characters, into the composer and add a space:

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com
    
  3. Verify that the complete text becomes a link. Send it and verify that the sent message also shows the complete link.

  4. Paste the following hostname, whose first label has 64 characters, into the composer and add a space:

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com
    
  5. Verify that the complete text stays plain, with no part converted into a link. Send it and verify that the sent message also stays plain.

  6. Repeat steps 2 through 5 with https:// added before both hostnames and verify the same results.

  7. Paste the following URL into the composer and add a space:

    https://foo.com.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.net
    
  8. Verify that the entire URL stays plain. In particular, https://foo.com must not become a link on its own.

  9. Send it and verify that the sent message also stays completely plain.

Test 2: Complete hostname length

  1. Open any chat.

  2. Paste the following 253-character hostname into the composer and add a space:

    abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde.com
    
  3. Verify that the complete text becomes a link. Send it and verify that the sent message also shows the complete link.

  4. Paste the following 254-character hostname into the composer and add a space:

    aa.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.com
    
  5. Verify that the complete text stays plain, with no part converted into a link. Send it and verify that the sent message also stays plain.

  6. Repeat steps 2 through 5 with https:// added before both hostnames and verify the same results.

Test 3: Oversized hostname

  1. Open the App on Web and open any chat.

  2. Open Chrome DevTools and select the Console tab.

  3. Run:

    copy('a'.repeat(8496) + '.com')
  4. Paste the copied text into the composer and add a space after .com.

  5. Verify that the text stays plain, with no part converted into a link.

  6. Verify that the maximum comment length error is not displayed.

Test 4: Email with an oversized domain

  1. Open any chat.

  2. Paste the following text into the composer and add a space:

    valid.net foo.bar@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com valid.org
    
  3. Verify that valid.net and valid.org become links.

  4. Verify that the entire email address stays plain. Neither foo.bar nor the text after @ should receive link or mention styling.

  5. Send the message and verify that the same parts remain linked or plain.

  6. Send [email protected] separately and verify that this normal email address becomes an email link.

  • Verify that no errors appear in the JS console

Offline tests

Same as Test

QA Steps

Same as Test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app 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 tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android-native-1.mov
Android-native-2.mov
Android-native-3.mov
Android: mWeb Chrome
Android-mweb-1.mov
Android-mweb-2.mov
Android-mweb-3.mov
iOS: Native
iOS-native-1.mp4
iOS-native-2.mov
iOS-native-3.mov
iOS: mWeb Safari
iOS-safari-1.mov
iOS-safari-2.mov
iOS-safari-3.mov
MacOS: Chrome / Safari
macOS-1.mp4
macOS-2.mp4

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@Uzaifm127
Uzaifm127 marked this pull request as ready for review October 23, 2026 12:48
@Uzaifm127
Uzaifm127 requested a review from a team as a code owner October 23, 2026 12:48
@melvin-bot
melvin-bot Bot requested review from linhvovan29546 and removed request for a team October 23, 2026 12:48
@melvin-bot

melvin-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

@linhvovan29546 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]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T13:10:30.856270Z a786382 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Uzaifm127 Uzaifm127 changed the title [WIP] upgrade: update expensify-common to 2.0.213 to enforce URL hostname length limits upgrade: update expensify-common to 2.0.213 to enforce URL hostname length limits Oct 23, 2026
@Uzaifm127 Uzaifm127 changed the title upgrade: update expensify-common to 2.0.213 to enforce URL hostname length limits upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits Oct 23, 2026
@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@linhvovan29546 I don't think Mobile-Expensify PR is needed here since all of the changes are JS changes, but still a second check from your side is appreciable :)

TY!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a786382175

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Uzaifm127

Copy link
Copy Markdown
Contributor Author

I'll look into the codex suggestions on tomorrow, thanks

@linhvovan29546

Copy link
Copy Markdown
Contributor

@Uzaifm127 Do we need to bump expensify-common in live-markdown?

@Uzaifm127

Uzaifm127 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@linhvovan29546 IMO, we don't need to bump react-native-live-markdown to bring the URL validation from expensif-common in the App. There is a NO from my side but I would still say, a check from your side too will be appreciable :)

btw, looking into the suggestions...

TY

@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@linhvovan29546 Both codex suggestions above are real, we missed these cases during expensify-common PR but luckily codex caugth these regressions upfront so I'm raising an another follow up PR in expensify-common to fix these cases and other similar regressions cases if any.

Since these cases have been caught before the final upgarde PR goes to production so these won't be considered as regressions.

TY

@Uzaifm127

Uzaifm127 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Update: @linhvovan29546 The follow up PR in expensify-common is WIP which is covering the missed cases mentioned above. I'm holding this PR untill that expensify-common follow up PR has been merged. Thanks.

@Uzaifm127 Uzaifm127 changed the title upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits [HOLD for expensify-common/pull/#966] upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits Oct 29, 2026
@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@linhvovan29546 The follow up PR in expensify-common covering the above cases is ready for review. Thanks.

@Uzaifm127 Uzaifm127 changed the title [HOLD for expensify-common/pull/#966] upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits Nov 1, 2026
@Uzaifm127 Uzaifm127 changed the title upgrade: bump expensify-common to 2.0.213 to enforce URL hostname length limits upgrade: bump expensify-common to 2.0.224 to enforce URL hostname length limits Nov 1, 2026
@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@linhvovan29546 This PR is ready for review. Thanks.

Note: There is one mistake I did, I accidentally pushed the last commit with commit message including the expensify-common version 2.0.223 but it should actually be 2.0.224, my bad.

@linhvovan29546

linhvovan29546 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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 Issues section 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 Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • 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 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 any copy / text that was added to the app 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 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 using Avatar have 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 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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 main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • 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 Simulator Screenshot - iPhone 17 Pro Max - 2026-11-03 at 18 30 28
iOS: mWeb Safari
MacOS: Chrome / Safari Screenshot 2026-11-03 at 18 30 52

@melvin-bot
melvin-bot Bot requested a review from JS00001 November 3, 2026 11:35
@JS00001

JS00001 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@Uzaifm127 are all of the gh action changes needed?

@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@JS00001 Yes, IMO both GitHub Action changes are required for this dependency upgrade. I ran npm run gh-actions-build, which rebuilt the action bundles with [email protected]. They include the URL validation changes from our PRs, along with the removal of resetPassword and setPassword from expensify-common #965, which merged between our initial PR and the follow-up. Those API removals are unrelated to our URL work, but they’re part of the upgraded package, so the generated bundles need to stay in sync.

@JS00001
JS00001 merged commit 0747ddf into Expensify:main Nov 3, 2026
48 of 53 checks passed
@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚧 JS00001 has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants