hickory-dns icon indicating copy to clipboard operation
hickory-dns copied to clipboard

<&str as IntoName>::into_name("1.2.3.4") returns Ok(_)

Open tamird opened this issue 2 years ago • 3 comments

Per RFC 1123 section 2.1:

If a dotted-decimal number can be entered without such identifying delimiters, then a full syntactic check must be made, because a segment of a host domain name is now allowed to begin with a digit and could legally be entirely numeric (see Section 6.1.2.4). However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic.

The current implementation does not reject this.

tamird avatar Jun 15 '22 16:06 tamird

I suppose we can add a check for this. I don't have any issue with that. It would need to come on the next release boundary though.

bluejekyll avatar Jul 11 '22 21:07 bluejekyll

Quite a good sum up of the actual "state of the art" https://stackoverflow.com/questions/9071279/number-in-the-top-level-domain Some possible possibilities: (not a maintainer nor contributor to trustdns just making suggestions)

  • Have a list of "now valid TLD to check against" like Firefox/chromium (don't know it's still the case)
  • Try to find the good parsing of the last label in case of FQDN.
  • Or having something like a fn is_rfc1123_hostname() regex/parser based solution to check if needed if a Name is valid like in PowerDNS.

darnuria avatar Aug 05 '22 20:08 darnuria

That’s a really helpful link. Thanks for sharing.

bluejekyll avatar Aug 05 '22 21:08 bluejekyll