Repository navigation
Conversation
Node.js 25 made DEP0123 End-of-Life, so tls.connect throws when servername is an IP address, and secure channels to an IP target never connect. Skip SNI for IP targets, as Node's https agent does. Fixes grpc#3127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Fixes #3127. Node.js 25 made DEP0123 End-of-Life, so
tls.connectthrowsERR_INVALID_ARG_VALUEwhenservernameis an IP address. Secure channels to an IP target never connect, and the caller only sees14 UNAVAILABLE.getConnectionOptions if grpc.ssl_target_name_override servername = override - else + else if !net.isIP(remoteHost) servername = remoteHostNode's own https agent skips SNI for IP addresses in the same way. Certificate verification is unchanged:
checkServerIdentitystill gets the IP and checks it against the certificate's IP SANs.Evidence
New test
Should connect to an IP address targetintest-channel-credentials.tsconnects to127.0.0.1:<port>with no name override.14 UNAVAILABLE: No connection established. Last error: TypeError [ERR_INVALID_ARG_VALUE]: ... Setting the TLS ServerName to an IP address is not permitted.. Received '127.0.0.1'On Node.js 24 and older the test passes either way, because an IP servername only triggers a warning there.
To run the TLS tests on Node.js 26 I had to lower OpenSSL to security level 1 (
--openssl-configwithCipherString = DEFAULT@SECLEVEL=1). The fixture keys are 1024-bit, and Node 26's default rejects them withee key too small, with or without this change.Merge Danger
Door: two-way.
Blast Radius: TLS channels whose target is an IP address with no
grpc.ssl_target_name_override. They no longer send SNI, which Node.js already left out for IP addresses before it started throwing.🤖 Generated with Claude Code