Skip to content

test(idn-hostname): reject A-labels that decode to an invalid U-label#935

Open
vtushar06 wants to merge 2 commits into
json-schema-org:mainfrom
vtushar06:idn-hostname-alabel-decode
Open

test(idn-hostname): reject A-labels that decode to an invalid U-label#935
vtushar06 wants to merge 2 commits into
json-schema-org:mainfrom
vtushar06:idn-hostname-alabel-decode

Conversation

@vtushar06

@vtushar06 vtushar06 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Following the methodology I used for ipv4 and uuid, I read RFC 5890 section 2.3.2.1 and found the current idn-hostname.json tests Punycode validity but never an A-label that decodes to an invalid U-label.

A string is only an A-label if it decodes to a valid U-label. A validator that accepts any well-formed xn-- without decoding and re-checking the result will accept labels whose U-label is invalid.

Changes

  • Added 2 test cases across draft7, draft2019-09, draft2020-12, and v1.
  • xn--7a decodes to U+00A1, which is DISALLOWED (RFC 5892 section 2.6) - invalid.
  • xn--0ca24w decodes to a-grave + Hebrew aleph, which violates the Bidi rule (RFC 5893) - invalid.

Ecosystem Impact

  1. python-jsonschema 4.x: PASSES both (rejects them). idna.encode decodes and re-validates.
  2. Go x/net/idna, Node (WHATWG), PHP idn_to_ascii, java.net.IDN: FAIL xn--7a (accept it). Node also FAILS xn--0ca24w.

RFC References

Reproduction commands and the idn-hostname cross-implementation matrix are in my evidence repo: https://github.com/vtushar06/JSON-Schema-format-test-Evidence/blob/main/idn-hostname.md

Related: #965

Copilot AI review requested due to automatic review settings June 11, 2026 18:06
@vtushar06 vtushar06 requested a review from a team as a code owner June 11, 2026 18:06

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jviotti jviotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect. Looks valid!

@jdesrosiers jdesrosiers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

We cover this in hostname.json, but it's completely missing in idn-hostname.json.

@jdesrosiers

Copy link
Copy Markdown
Member

Needs rebase.

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