import type { ExecutorConfig } from "../config/ExecutorConfig.js"; import type { EgressCode } from "./EgressError.js"; /** One origin this process may reach, the paths under it, and how it is trusted. */ export interface EgressDestination { readonly origin: string; readonly pathPrefixes: readonly string[]; /** The PEM bundle to verify the peer against; the platform's store when null. */ readonly ca: string | null; readonly pins: readonly string[]; } export type EgressCheck = { readonly allowed: true; readonly destination: EgressDestination; } | { readonly allowed: false; readonly code: EgressCode; }; /** * The sealed allowlist of where this process may open a connection: the * authority, the Presence service when this process holds that credential, * and the downstream and its lookup, each with the path prefix the * configuration named and the trust anchor it declared. Nothing is added at * run time; a handler that reaches elsewhere is refused before a socket * exists. Private address ranges are allowed by design, because that is * where an institution's systems live; what a configured name must never * resolve to is this host, the link, multicast, or nowhere. */ export declare class EgressPolicy { private readonly destinations; constructor(destinations: readonly EgressDestination[]); /** The policy a configuration implies; CA bundles are read once, here. */ static fromConfig(config: ExecutorConfig, readFile: (path: string) => string): EgressPolicy; get origins(): readonly string[]; /** Scheme, origin, then path, in that order; the first failure is the answer. */ check(url: URL): EgressCheck; /** The prefix itself, or anything below it as a path segment; never a sibling that merely shares characters. */ static underPrefix(pathname: string, prefix: string): boolean; /** * Whether a resolved address may be connected to for an origin. A loopback * origin must stay on this host; any other must never resolve to this * host, the link, multicast, or nowhere. `publicOnly` is for a destination * someone other than the operator chose, as a hosted gateway's tenant * chooses its upstream: it also refuses every private and shared range, * the Azure platform address, and NAT64, so a name cannot reach inward. * IPv4-mapped IPv6 addresses match the IPv4 ranges. The lists are built per * call so that nothing about them is decided at module load. */ static addressRefused(address: string, loopbackOrigin: boolean, publicOnly?: boolean): boolean; /** * Whether a URL's hostname is an address, written as the host, that the * policy refuses. Connecting to such a host resolves nothing, so the * resolver's check never sees it; this is that check. A name that is not an * address is not refused here. */ static hostAddressRefused(hostname: string, publicOnly?: boolean): boolean; /** A URL's hostname as the address it is, without an IPv6 address's brackets; null for a name. */ static addressOf(hostname: string): string | null; /** The three loopback spellings the configuration accepts. */ static isLoopbackHost(hostname: string): boolean; /** The origin the configuration named, exactly as the URL class spells it. */ static originOf(url: string): string; /** The path the configuration named, cut at a placeholder such as `{idempotency_key}`. */ static prefixOf(url: string): string; /** `sha256/` over a DER SubjectPublicKeyInfo: the pin form the configuration takes. */ static spkiPin(spki: Uint8Array): string; private static bundle; } //# sourceMappingURL=EgressPolicy.d.ts.map