tls: match IPv6 hosts against IP-Address SANs#64145
Open
JumpLink wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
checkServerIdentity() stopped matching an IPv6 host against a matching
IP-Address SAN. The hostname is now run through domainToASCII() before
the net.isIP() gate, and domainToASCII('::1') === '' (an IPv6 literal is
not a domain), so net.isIP('') is 0, the IP-SAN branch is skipped, and
verification fails with "Cert does not contain a DNS name". IPv4 is
unaffected because dotted-decimal survives domainToASCII().
Match IP hosts against the original hostname instead of the IDNA-
normalized one. net.isIP() rejects non-ASCII input, so there is no IDNA
confusion to guard against for an IP literal; the normalized form is
still used for the DNS-name path.
Fixes: nodejs#64144
Signed-off-by: Pascal Garber <pascal@artandcode.studio>
9bbc413 to
33116ec
Compare
Author
|
@pimterry sorry for the extra ping! The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tls.checkServerIdentity()stopped matching an IPv6 host against a matchingIP AddressSAN, returningERR_TLS_CERT_ALTNAME_INVALID(Cert does not contain a DNS name) where it used to returnundefined.The hostname is now run through
domainToASCII()before thenet.isIP()gate, anddomainToASCII('::1') === ''(an IPv6 literal is not a domain), sonet.isIP('')is0, the IP-SAN branch is skipped, and (with no DNS SAN / CN) it falls through to the no-identifier reason. IPv4 is unaffected because dotted-decimal survivesdomainToASCII().This matches IP hosts against the original hostname instead of the IDNA-normalized one.
net.isIP()rejects non-ASCII input, so there is no IDNA confusion to guard against for an IP literal; the normalized form is still used for the DNS-name path. Adds IPv6 IP-SAN coverage (match, canonical-form match, non-match) totest-tls-check-server-identity.Fixes: #64144