Repository navigation
fix(socks5): handle bracketed IPv6 literals for proxy and target hosts - #6243
Open
hoanle0126 wants to merge 1 commit into
Open
hoanle0126 wants to merge 1 commit into
hoanle0126 wants to merge 1 commit into
Conversation
Signed-off-by: Nacy Dev <hoanle0126@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6243 +/- ##
==========================================
+ Coverage 91.74% 91.77% +0.03%
==========================================
Files 113 113
Lines 44849 44873 +24
==========================================
+ Hits 41147 41184 +37
+ Misses 3702 3689 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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...
N/A
Rationale
URL.prototype.hostnamereturns IPv6 literals wrapped in square brackets (such as[::1]).Socks5ProxyAgentforwarded those bracketed strings directly to the proxy connector and to SOCKS5 CONNECT, andparseAddresscheckednet.isIPv6without stripping the brackets. Connecting to an IPv6 SOCKS5 proxy failed withENOTFOUND, and IPv6 target origins were encoded as domain names (ATYP 0x03) instead of 16-byte IPv6 addresses (ATYP 0x04) per RFC 1928.Changes
Strip surrounding brackets from valid IPv6 literals in
socks5-utils(parseAddressandparseIPv6) and normalize proxy and target hostnames in Socks5ProxyAgent before connecting or sending the SOCKS5 CONNECT request. UsegetServerNamefor the default proxy TLS servername so IP-literal proxy URLs do not pass an IP or bracketed host as SNI.Features
N/A
Bug Fixes
Breaking Changes and Deprecations
N/A
Status