refactor: dedupe browser security string helper

This commit is contained in:
Peter Steinberger
2026-04-06 22:53:48 +01:00
parent 29163a8caa
commit 8e3c597e80
2 changed files with 5 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import { formatCliCommand } from "openclaw/plugin-sdk/setup-tools";
import { isPrivateNetworkOptInEnabled, isPrivateIpAddress } from "openclaw/plugin-sdk/ssrf-policy";
import { redactCdpUrl, resolveBrowserConfig, resolveProfile } from "./browser/config.js";
import { resolveBrowserControlAuth } from "./browser/control-auth.js";
import { hasNonEmptyString } from "./record-shared.js";
const BLOCKED_HOSTNAMES = new Set([
"localhost",
@@ -11,10 +12,6 @@ const BLOCKED_HOSTNAMES = new Set([
"metadata.google.internal",
]);
function hasNonEmptyString(value: unknown): boolean {
return typeof value === "string" && value.trim().length > 0;
}
function isTrustedPrivateHostname(hostname: string): boolean {
const normalized = hostname.trim().toLowerCase();
return normalized.length > 0 && BLOCKED_HOSTNAMES.has(normalized);