mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
fix(cli): use startsWith for loopback IPv4 check in container proxy (#106077)
isLoopbackProxyHostname used split(".", 1)[0] === "127" to detect
127.0.0.0/8 addresses. While isIP() already rejects leading-zero octets
before this branch is reached, startsWith("127.") is more direct and
clearly expresses the intent of matching the entire 127.0.0.0/8 range.
This commit is contained in:
@@ -184,7 +184,7 @@ function isLoopbackProxyHostname(hostname: string): boolean {
|
||||
return true;
|
||||
}
|
||||
if (isIP(normalizedHostname) === 4) {
|
||||
return normalizedHostname.split(".", 1)[0] === "127";
|
||||
return normalizedHostname.startsWith("127.");
|
||||
}
|
||||
const ipv6Hostname = normalizedHostname.replace(/^\[|\]$/g, "");
|
||||
if (isIP(ipv6Hostname) !== 6) {
|
||||
|
||||
Reference in New Issue
Block a user