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

@watilde watilde commented May 28, 2026

Copy link
Copy Markdown
Member

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.

@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

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 90.14%. Comparing base (db3a8d8) to head (467c34b).
⚠️ Report is 550 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63619   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files         741      741           
  Lines      242133   242135    +2     
  Branches    45568    45559    -9     
=======================================
+ Hits       218265   218269    +4     
+ Misses      15371    15364    -7     
- Partials     8497     8502    +5     
Files with missing lines Coverage Ξ”
lib/internal/net.js 100.00% <100.00%> (ΓΈ)

... and 26 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.

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

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 ?

@watilde watilde added the request-ci Add this label to start a Jenkins CI on a PR. label May 29, 2026
@watilde

watilde commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

@Ethan-Arrowood Thanks for your comment, I've updated.

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 14, 2026
@nodejs-github-bot

This comment was marked as outdated.

@watilde watilde added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2026
@nodejs-github-bot

This comment was marked as outdated.

watilde added 2 commits July 22, 2026 02:13
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@trivikr trivikr added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 22, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 22, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Commit Queue failed

   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - net: recognize bare IPv6 loopback addresses in isLoopback
   ⚠  - test: add non-loopback IPv6 cases to isLoopback test
   ✘  6 failure(s) on the last Jenkins CI run

The pull request was removed from the Commit Queue and labeled commit-queue-failed An error occurred while landing this pull request using GitHub Actions. . After resolving the failure, remove that label and add commit-queue Add this label to land a pull request using GitHub Actions. to retry.

Full Commit Queue output
- Loading data for nodejs/node/pull/63619
βœ”  Done loading data for nodejs/node/pull/63619
----------------------------------- PR info ------------------------------------
Title      net: recognize bare IPv6 loopback addresses in isLoopback (#63619)
Author     Daijiro Wachi <daijiro.wachi@gmail.com> (@watilde)
Branch     watilde:fixes-net -> nodejs:main
Labels     net, author ready, needs-ci, commit-queue, commit-queue-squash
Commits    2
 - net: recognize bare IPv6 loopback addresses in isLoopback
 - test: add non-loopback IPv6 cases to isLoopback test
Committers 1
 - Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63619
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/63619
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
--------------------------------------------------------------------------------
   β„Ή  This PR was created on Thu, 28 May 2026 13:22:55 GMT
   βœ”  Approvals: 2
   βœ”  - Ethan Arrowood (@Ethan-Arrowood): https://github.com/nodejs/node/pull/63619#pullrequestreview-4695314656
   βœ”  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/63619#pullrequestreview-4749855586
   βœ”  Last GitHub CI successful
   β„Ή  Last Full PR CI on 2026-07-21T00:52:57Z: https://ci.nodejs.org/job/node-test-pull-request/74934/
   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - net: recognize bare IPv6 loopback addresses in isLoopback
   ⚠  - test: add non-loopback IPv6 cases to isLoopback test
- Querying data for job/node-test-pull-request/74934/
βœ”  Build data downloaded
- Querying failures of job/node-test-commit/89607/
βœ”  Data downloaded
   ✘  6 failure(s) on the last Jenkins CI run
--------------------------------------------------------------------------------
   βœ”  Aborted `git node land` session in /home/runner/work/node/node/.ncu

View workflow run

@nodejs-github-bot

This comment was marked as outdated.

@panva panva added request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Aug 23, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 23, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants