Skip to content

fix: allow Unicode domains in URI validation - #3133

Open
jackwalkerlabs wants to merge 1 commit into
hapijs:masterfrom
jackwalkerlabs:fix/uri-unicode-domain
Open

fix: allow Unicode domains in URI validation#3133
jackwalkerlabs wants to merge 1 commit into
hapijs:masterfrom
jackwalkerlabs:fix/uri-unicode-domain

Conversation

@jackwalkerlabs

Copy link
Copy Markdown

Fixes #3068

The URI regex rejected non-ASCII hosts before the Unicode-aware domain validation ran. This adds a validation-only fallback that percent-encodes non-ASCII characters for structural matching only when all encoding changes are confined to the captured host. The original Unicode domain is then checked with the configured domain rules, and the input stays unchanged unless encodeUri conversion was requested.

Tests cover raw Unicode hosts, relative URIs, percent-encoded paths, allowUnicode: false, convert: false, existing encodeUri behavior, Unicode outside the host, and malformed surrogate input.

Validation:

  • npm test on Node 25.8.2: 1,819 tests, 100% coverage, lint, types, and leak checks clean
  • The same complete command via Node 20.20.2: same result

AI assistance: used for investigation, implementation, and test review; every submitted change and validation result was reviewed.

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.

String uri domain option does not allow Unicode when option is enabled

1 participant