mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:50:43 +00:00
refactor: dedupe browser security string helper
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user