Skip to content

fix(socks5): encode embedded IPv4 tails in IPv6 literals correctly#5099

Merged
mcollina merged 1 commit intonodejs:mainfrom
trivikr:parse-ipv6
Apr 24, 2026
Merged

fix(socks5): encode embedded IPv4 tails in IPv6 literals correctly#5099
mcollina merged 1 commit intonodejs:mainfrom
trivikr:parse-ipv6

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 24, 2026

This relates to...

Fixes: #5098

Rationale

parseIPv6() in the SOCKS5 utilities treated each post-:: segment as a hexadecimal hextet. That breaks valid IPv6 literals with an embedded IPv4 tail, causing Undici to write the wrong 16-byte destination address into SOCKS5 connect requests.

Changes

Normalize embedded IPv4 tails in parseIPv6() before expanding compressed IPv6 notation.

Features

N/A

Bug Fixes

Correct SOCKS5 IPv6 address encoding for IPv4-mapped IPv6 literals.

Breaking Changes and Deprecations

N/A

Status

Assisted-by: openai:gpt-5.4

Assisted-by: openai:gpt-5.4
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.14%. Comparing base (2a6f9c7) to head (730e1cd).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5099      +/-   ##
==========================================
+ Coverage   93.13%   93.14%   +0.01%     
==========================================
  Files         110      110              
  Lines       35816    35840      +24     
==========================================
+ Hits        33356    33382      +26     
+ Misses       2460     2458       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit d76f932 into nodejs:main Apr 24, 2026
35 checks passed
@trivikr trivikr deleted the parse-ipv6 branch April 24, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseIPv6() mis-encodes valid IPv6 literals that end with an embedded IPv4 address

3 participants