Skip to content

net: recognize bare IPv6 loopback addresses in isLoopback#63619

Open
watilde wants to merge 2 commits into
nodejs:mainfrom
watilde:fixes-net
Open

net: recognize bare IPv6 loopback addresses in isLoopback#63619
watilde wants to merge 2 commits into
nodejs:mainfrom
watilde:fixes-net

Conversation

@watilde
Copy link
Copy Markdown
Member

@watilde watilde commented May 28, 2026

isLoopback() only matched bracket-wrapped IPv6 loopback addresses ([::1], [0:0:0:0:0:0:0:1]), but not the bare forms (::1, 0:0:0:0:0:0:0:1) that can appear when callers strip the brackets before passing the host string.

This change adds the two bare forms to the check so isLoopback returns true regardless of whether the IPv6 address is bracket-wrapped or not.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (8d0a3b8) to head (ec33f4e).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63619   +/-   ##
=======================================
  Coverage   90.29%   90.29%           
=======================================
  Files         730      730           
  Lines      234782   234818   +36     
  Branches    43953    43964   +11     
=======================================
+ Hits       211993   212036   +43     
+ Misses      14501    14495    -6     
+ Partials     8288     8287    -1     
Files with missing lines Coverage Δ
lib/internal/net.js 100.00% <100.00%> (ø)

... and 35 files with indirect coverage changes

🚀 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
Contributor

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

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

I believe this change is a valid patch. Can you update the PR description? And maybe add some cases to th eloopbackNot array like ::2 and 0:0:0:0:0:0:0:2 ?

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@watilde watilde added the request-ci Add this label to start a Jenkins CI on a PR. label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. request-ci Add this label to start a Jenkins CI on a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants