Repository navigation
fix(proxy): do not set an IP-literal proxy as the TLS servername - #6148
Open
MIbtehajNasar wants to merge 1 commit into
Open
MIbtehajNasar wants to merge 1 commit into
MIbtehajNasar wants to merge 1 commit into
Conversation
ProxyAgent pinned the TLS servername (SNI) of the connection to the proxy to the proxy host. When the proxy is addressed by an IP literal this sets SNI to an IP, which is invalid per RFC 6066; Node >= 26 rejects it outright with ERR_INVALID_ARG_VALUE before the handshake, so every request through an IP-addressed HTTPS proxy fails. Derive the pinned servername through util.getServerName(), which returns '' for an IP address. An IP-addressed proxy is then connected to without SNI, while a hostname proxy is still pinned to its name. Applies to both the forward (non-tunnel) and tunnel paths. Fixes: nodejs#6144
3 of 7 tasks
This branch has not been deployed
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.
This relates to...
Fixes #6144
Rationale
ProxyAgentpins the TLS servername (SNI) of the connection to the proxy to the proxy host, so the handshake is validated against the proxy rather than the (rewritten) target Host header. When the proxy is addressed by an IP literal (e.g.new ProxyAgent("https://127.0.0.1:8080")), this sets the SNI to an IP address.SNI must be a hostname, never an IP (RFC 6066). Node 26 now enforces this and throws before the handshake:
So on Node 26 every request through an IP-addressed HTTPS proxy fails outright. Older Node silently sent the (invalid) IP SNI.
Changes
Derive the pinned proxy servername through
util.getServerName(), which already returns''for an IP address (and the hostname otherwise). An IP-addressed proxy is then connected to without SNI, while a hostname proxy is still pinned to its name. Applied to both the forward (non-tunnel) and tunnel code paths.Features
N/A
Bug Fixes
ProxyAgentno longer sets the TLS servername to an IP literal when the proxy is addressed by IP, fixingERR_INVALID_ARG_VALUEon Node >= 26 and the invalid SNI sent on older Node (ProxyAgent fails with IP-address HTTPS proxies on Node 26 #6144).Breaking Changes and Deprecations
N/A
Status