Skip to content

dns: use IDNA 2008 to encode non-ascii hostnames

Rodrigo Muino Tomonari requested to merge github/fork/bnoordhuis/fix25558 into master

Before this commit, Node.js left it up to the system resolver or c-ares.

Leaving it to the system resolver introduces platform differences because:

  • some support IDNA 2008
  • some only IDNA 2003 (glibc until 2.28), and
  • some don't support IDNA at all (musl libc)

c-ares doesn't support IDNA either although curl does, by virtue of linking against libidn2. Upgrading from libidn1 to libidn2 in order to get proper IDNA 2008 support was the fix for curl's CVE-2016-8625.

libidn2 is not an option (incompatible license) but ICU has an IDNA API and we already use that in one place. For non-ICU builds, we fall back to the bundled punycode.js that also supports IDNA 2008.

Fixes: https://github.com/nodejs-private/security/issues/97

cc @santigimeno - I'm not too hung up on whether this PR lands or #25559 but this way at least you can compare the two. :)

Merge request reports

Loading