UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

47 lines (46 loc) • 1.56 kB
import { o as redactSensitiveUrlLikeString } from "./redact-sensitive-url-D-E7DGoc.mjs"; import { t as buildGatewayConnectionDetails } from "./call-DVCK1deJ.mjs"; import { t as resolveGatewayProbeTarget } from "./probe-target-oXM4-nUO.mjs"; import { n as resolveGatewayProbeAuthSafe } from "./probe-auth-CWenh0cl.mjs"; import { n as probeGateway } from "./probe-yxDLQFmi.mjs"; //#region src/security/audit-gateway-probe.ts async function probeSecurityAuditGateway(e) { const t = buildGatewayConnectionDetails({ config: e.cfg }); const n = t.url; const r = resolveGatewayProbeTarget(e.cfg); const i = resolveGatewayProbeAuthSafe({ cfg: e.cfg, env: e.env, mode: r.mode, explicitAuth: e.explicitAuth }); const a = await (e.probe ?? probeGateway)({ url: n, config: e.cfg, env: e.env, configuredRemote: t.urlSource === "config gateway.remote.url", originScopedDeviceAuth: r.mode === "remote" || Boolean(process.env.OPENCLAW_GATEWAY_URL?.trim()), auth: i.auth, timeoutMs: e.timeoutMs }).catch((e) => ({ ok: false, error: String(e), close: null })); if (i.warning && !a.ok) a.error = a.error ? `${a.error}; ${i.warning}` : i.warning; return { deep: { gateway: { attempted: true, url: redactSensitiveUrlLikeString(n), ok: a.ok, error: a.ok || a.error === null ? null : redactSensitiveUrlLikeString(a.error), close: a.close ? { code: a.close.code, reason: redactSensitiveUrlLikeString(a.close.reason) } : null } }, authWarning: i.warning }; } //#endregion export { probeSecurityAuditGateway };