Skip to content

Empty labels (consecutive dots, and trailing dot for host writing + UTS46) #871

@ukusormus

Description

@ukusormus

What is the issue with the URL Standard?

  1. Is there any reason to continue allowing consecutive dots in a domain, at all?
new URL("https://a...b..c...d./").hostname  // "a...b..c...d."
  1. Should 2.1) consecutive dots 2.2) a trailing dot be allowed under "Host writing" (beStrict = true => VerifyDnsLength = true), as per UTS46:
u = new URL("https://example.com/")
u.host = "a...b..c...d."
u.host  // "a...b..c...d."

https://www.unicode.org/reports/tr46/#ToASCII:

Break the result into labels at U+002E FULL STOP.
...
If the VerifyDnsLength flag is true, then verify DNS length restrictions.
...
The length of each label is from 1 to 63
...
When VerifyDnsLength is true, the empty root label is disallowed.

Last two sentences seem violated from the above URL API example - there are empty labels, including root label.

Snips of relevant sections as of current commit:

3.3. IDNA
The domain to ASCII algorithm, given a string domain and a boolean beStrict, runs these steps:
1. Let result be the result of running Unicode ToASCII with [...] VerifyDnsLength set to beStrict [...]. [UTS46]

Note: If beStrict is false, domain is an ASCII string, and strictly splitting domain on U+002E (.) does not produce any item that starts with an ASCII case-insensitive match for "xn--", this step is equivalent to ASCII lowercasing domain.


3.4. Host writing
...
A string input is a valid domain if these steps return true:
1. Let domain be the result of running domain to ASCII with input and true.


3.5. Host parsing
...
5. Let asciiDomain be the result of running domain to ASCII with domain and false.

(under host writing, beStrict = true, but under parsing, beStrict = false)


From PSL definitions section: "Empty labels are not permitted."

$ dig a..b
dig: 'a..b' is not a legal name (empty label)

May be relevant reply from another issue from another person: #245 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions