From 102d4cfbbe6eef8f1b22bd7dfbe4f596b76c0ed6 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 80de67791512e4..d4d06dd5d22e21 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 ec33f4e661a4ae2e1ad272a97adab0c5079685fa 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) {