Skip to content

Input validation uses a Unicode property escape that breaks on no-ICU Node (nodejs-mobile) #520

Closed

Description

@melvincarvalho

Summary

src/server.js:1075 validates printable input with a Unicode property-escape regex:

/^\P{C}+$/u.test(str)

On Node builds without full ICU — notably nodejs-mobile (the embedded Node used for the Android app) — this throws at module-load time:

SyntaxError: Invalid regular expression: /^\P{C}+$/: Invalid property name

Because it's a top-level regex literal, the whole module fails to import and the server never starts.

Impact

JSS can't boot on no-ICU / small-ICU runtimes. Surfaced while embedding JSS in a React Native + nodejs-mobile Android app. We currently work around it downstream by rewriting the regex to an ASCII range before bundling, but JSS itself would be more portable without the property escape.

Suggested fix

Replace the \P{C} (any non-control-category char) escape with an explicit ASCII control-character exclusion that needs no ICU:

/^[^\x00-\x1f\x7f-\x9f]+$/.test(str)

This matches "no C0/C1 control chars" — close to the original intent for input sanitization, and works on every Node build. If full-Unicode control coverage is genuinely required, document a full-ICU runtime requirement instead.

Location

  • src/server.js:1070-1075

Activity

  1. added
    bug
    on May 23, 2026
  2. melvincarvalho commented on May 23, 2026

    @melvincarvalho
    ContributorAuthor

    Surfaced by the Android (nodejs-mobile) work — tracked in #522.

  3. added a commit that references this issue on May 24, 2026
    ad289f9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions