From d087262117126873f6e348c4d7688bfef5655175 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Thu, 28 May 2026 22:04:37 +0900 Subject: [PATCH 1/2] net: recognize bare IPv6 loopback addresses in isLoopback Signed-off-by: Daijiro Wachi --- lib/internal/net.js | 4 +++- test/parallel/test-internal-net-isLoopback.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/internal/net.js b/lib/internal/net.js index cea3dda23d6176..2553449f0505d5 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -94,7 +94,9 @@ function isLoopback(host) { hostLower === 'localhost' || hostLower.startsWith('127.') || hostLower === '[::1]' || - hostLower === '[0:0:0:0:0:0:0:1]' + hostLower === '::1' || + hostLower === '[0:0:0:0:0:0:0:1]' || + hostLower === '0:0:0:0:0:0:0:1' ); } diff --git a/test/parallel/test-internal-net-isLoopback.js b/test/parallel/test-internal-net-isLoopback.js index df63bfc262eaf6..ab3105bac3d24a 100644 --- a/test/parallel/test-internal-net-isLoopback.js +++ b/test/parallel/test-internal-net-isLoopback.js @@ -10,7 +10,9 @@ const loopback = [ '127.0.0.255', '127.1.2.3', '[::1]', + '::1', '[0:0:0:0:0:0:0:1]', + '0:0:0:0:0:0:0:1', ]; const loopbackNot = [ From 467c34b7c2ee913d2b8ea6eec277ed22b2ba6d03 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Fri, 29 May 2026 15:43:29 +0900 Subject: [PATCH 2/2] test: add non-loopback IPv6 cases to isLoopback test Signed-off-by: Daijiro Wachi --- test/parallel/test-internal-net-isLoopback.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-internal-net-isLoopback.js b/test/parallel/test-internal-net-isLoopback.js index ab3105bac3d24a..d54533ec0dd5fb 100644 --- a/test/parallel/test-internal-net-isLoopback.js +++ b/test/parallel/test-internal-net-isLoopback.js @@ -23,6 +23,10 @@ const loopbackNot = [ '[2001:db8::1]', '[fe80::1]', '8.8.8.8', + '::2', + '[::2]', + '0:0:0:0:0:0:0:2', + '[0:0:0:0:0:0:0:2]', ]; for (const address of loopback) {