net: recognize bare IPv6 loopback addresses in isLoopback

Signed-off-by: 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>
This commit is contained in:
Daijiro Wachi authored and GitHub committed 2026-09-02 03:55:41 +00:00
1 parent 20f5b0a283
commit e06b0f1350
2 files changed
+9 -1

No files matched your search

+3 -1
View File
@@ -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'
);
}
@@ -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 = [
@@ -21,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) {