Skip to content

Use ASCII control-range regex instead of Unicode property escape for password input#525

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-520-ascii-control-regex
May 24, 2026
Merged

Use ASCII control-range regex instead of Unicode property escape for password input#525
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-520-ascii-control-regex

Conversation

@melvincarvalho
Copy link
Copy Markdown
Contributor

Summary

  • src/server.js validated interactive password input with a Unicode property-escape regex (the \P{C} form with the u flag).
  • That throws SyntaxError: Invalid regular expression: Invalid property name at parse time on Node builds without full ICU (e.g. nodejs-mobile), so the module fails to import and the server can't boot there.
  • Replaced with an explicit exclusion of C0/C1 control code points (0x00–0x1F and 0x7F–0x9F) written as \u-escapes — no u flag, no ICU. Preserves the intent: keep control/escape bytes from arrow/function keys out of the password buffer.

Closes #520. Surfaced running JSS on Android (nodejs-mobile); see #522.

Notes

  • One-line scope. The no-ICU work also needs crypto.hash / toReversed / Intl shims, but those live in oidc-provider (Node-version assumptions), not JSS — see OIDC IdP 500s on Node <20: @koa/router (via oidc-provider) uses Array#toReversed #523.
  • Behavior: the property escape also excluded format / surrogate / private-use / unassigned code points; this excludes only C0/C1 controls — the actual goal for password-buffer sanitization.

Test plan

  • Password prompt accepts normal input, rejects control/escape sequences.
  • createServer() imports on a no-ICU Node build (no parse-time throw).

/^\P{C}+$/u throws "Invalid property name" at parse time on Node builds
without full ICU (e.g. nodejs-mobile), so the module fails to load and
the server can't boot there. Replace with an explicit C0/C1 control
exclusion, which needs no ICU and matches the actual intent (keep
control/escape bytes out of the interactive password buffer).

Closes #520
@melvincarvalho melvincarvalho merged commit ad289f9 into gh-pages May 24, 2026
1 check passed
@melvincarvalho melvincarvalho deleted the issue-520-ascii-control-regex branch May 24, 2026 08:10
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.

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

1 participant