/** * Operator-supplied URL safety guard for outbound HTTP integrations. * * Callers use this before persisting or fetching user-configured URLs * that could otherwise probe internal services or leak credentials. * * The guard: * * Enforces http/https scheme (rejects file:, gopher:, etc.). * * For credentialed calls, requires https. * * Resolves the hostname via DNS and refuses loopback, link-local, * and RFC1918 / IPv6 ULA addresses. * * Escape hatch (either env disables the private-address block): * - AGIM_ACP_ALLOW_LOOPBACK=1 — historical name kept for old setups * - AGIM_URL_ALLOW_PRIVATE=1 — shared name for LLM/MCP/local URLs * Intended for development against `localhost:` / LAN Ollama etc.; * never set these in shared deployments. * * Callers that `fetch()` the URL should also pass `redirect: 'manual'` * so an allowed origin can't 302 the request into a blocked address. */ export interface AssertSafeOptions { /** When true, only https URLs are accepted because the request carries credentials. */ forwardsCredentials: boolean; } type LookupHost = (hostname: string) => Promise<{ address: string; family: number; }>; export declare class UnsafeUrlError extends Error { readonly reason: string; constructor(message: string, reason: string); } /** @deprecated Use UnsafeUrlError. */ export declare const UnsafeAcpUrlError: typeof UnsafeUrlError; export declare function assertSafeUrl(raw: string, opts: AssertSafeOptions, lookupHost?: LookupHost): Promise; /** @deprecated Use assertSafeUrl. */ export declare const assertSafeAcpUrl: typeof assertSafeUrl; /** RFC1918 + loopback + link-local + IPv6 ULA + 0.0.0.0. Exported for unit tests. */ export declare function isPrivateAddr(ip: string, family: 4 | 6): boolean; export {}; //# sourceMappingURL=url-guard.d.ts.map