From b22e302ae4ce7f0fc2568c40e04971835ba0f140 Mon Sep 17 00:00:00 2001 From: shin-core <153108882+shin-core@users.noreply.github.com> Date: Fri, 24 Jul 2026 19:39:49 +0900 Subject: [PATCH] fix(orb): drop unreachable bare ::1 branch in isLocalBrokerHost isLocalBrokerHost's hostname is always a WHATWG URL's .hostname, which always brackets an IPv6 literal ([::1], never bare ::1) -- so the hostname === "::1" comparison is dead code that can never match given how the function is actually called. Remove it, leaving the reachable localhost/127.0.0.1/[::1] forms, and add a comment noting why only the bracketed IPv6 form is checked so the bare form isn't reintroduced. Behavior-neutral; the existing bracketed-[::1] test still passes unchanged. --- src/orb/broker-client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/orb/broker-client.ts b/src/orb/broker-client.ts index dcc4b7d53..bec4ac755 100644 --- a/src/orb/broker-client.ts +++ b/src/orb/broker-client.ts @@ -19,7 +19,9 @@ const BROKER_TIMEOUT_MS = 25_000; const ORB_RELAY_REGISTER_TIMEOUT_MS = 25_000; function isLocalBrokerHost(hostname: string): boolean { - return hostname === "localhost" || hostname === "127.0.0.1" || (hostname === "::1" || hostname === "[::1]"); + // `hostname` is always a WHATWG URL's `.hostname`, which brackets an IPv6 literal ([::1], never bare ::1), + // so only the bracketed form is a reachable input here (#8334). + return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]"; } function orbBrokerBaseUrl(env: { ORB_BROKER_URL?: string | undefined }): string {