Skip to content

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

@melvincarvalho

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions