/** * HQ network-exposure guard. * * HQ binds to all interfaces by default so a fleet dashboard is reachable * from a phone or a second machine. That default is only safe because a * first run mints random browser + client tokens. * * The hole it leaves is the *open mode* an operator can configure by hand: * with no browser tokens and no password, `hq-server` skips its 401 branch * entirely — including on `POST /api/command`, which enqueues commands into * live sessions. Open mode was tolerable while HQ was loopback-only; paired * with a non-loopback bind it is unauthenticated remote command execution * reachable by any peer on the network. * * So: refuse that one combination, and warn about the merely-unencrypted * ones. Nothing here changes the default bind — it guards the case where the * default silently turns a local-only setup into a public one. */ /** * The bind the HQ *CLI* surfaces choose on purpose: HQ is the deliberate * cross-machine surface, so `wstack hq` and the launch menu reach every * interface without an extra flag. * * This deliberately does not live in `startHqServer`'s default. A caller * that never mentions a host — a test, an embedder — has not asked to be * published to its network, and that library default stays loopback. Keep * the two apart: collapsing them is what turns "HQ is reachable from my * phone" into "every embedder silently binds 0.0.0.0". */ export declare const HQ_CLI_DEFAULT_HOST = "0.0.0.0"; /** * Thrown when the bind host and the auth configuration combine into an * unauthenticated, network-reachable HQ. * * Lives here rather than beside the server so callers can identify it * without importing (or successfully mocking) the whole hq-server module. */ export declare class HqInsecureExposureError extends Error { constructor(message: string); } export interface HqExposureInput { /** Host HQ is about to bind. */ host: string; /** At least one browser token is configured. */ hasBrowserTokens: boolean; /** A browser password hash is configured. */ hasPassword: boolean; /** Operator opt-in that downgrades a refusal to a warning. */ allowInsecure?: boolean | undefined; } export type HqExposureVerdict = { kind: 'ok'; } | { kind: 'warn'; message: string; } | { kind: 'refuse'; message: string; }; /** Hosts that cannot receive traffic from another machine. */ export declare function isLoopbackHost(host: string): boolean; /** True when HQ would serve every request unauthenticated. Mirrors the * `(inBrowserTokenMode || inPasswordMode) && !auth` gate in hq-server. */ export declare function isOpenMode(input: Pick): boolean; export declare function assessHqExposure(input: HqExposureInput): HqExposureVerdict; //# sourceMappingURL=exposure.d.ts.map