mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:51:36 +00:00
fix(security): harden discovery routing and TLS pins
This commit is contained in:
@@ -30,12 +30,15 @@ export function parseDiscoverTimeoutMs(raw: unknown, fallbackMs: number): number
|
||||
}
|
||||
|
||||
export function pickBeaconHost(beacon: GatewayBonjourBeacon): string | null {
|
||||
const host = beacon.tailnetDns || beacon.lanHost || beacon.host;
|
||||
// Security: TXT records are unauthenticated. Prefer the resolved service endpoint (SRV/A/AAAA)
|
||||
// over TXT-provided routing hints.
|
||||
const host = beacon.host || beacon.tailnetDns || beacon.lanHost;
|
||||
return host?.trim() ? host.trim() : null;
|
||||
}
|
||||
|
||||
export function pickGatewayPort(beacon: GatewayBonjourBeacon): number {
|
||||
const port = beacon.gatewayPort ?? 18789;
|
||||
// Security: TXT records are unauthenticated. Prefer the resolved service port over TXT gatewayPort.
|
||||
const port = beacon.port ?? beacon.gatewayPort ?? 18789;
|
||||
return port > 0 ? port : 18789;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user