/** * Safe Fetch — SSRF-hardened binary download helper. * * Combines: * - `assertSafeUrl` (validates and rejects blocked IPs) * - undici `Agent` with custom `connect.lookup` so the actual connection * uses the IP we validated (closes the DNS-rebinding window where the * resolver returns a public IP for the guard but a private IP for the * real request). * - `readBoundedBuffer` for size cap. * - `redirect: "manual"` so a 3xx → private-IP redirect can't bypass * the guard. * * Use this for **every** download of an external (caller-supplied or * third-party-returned) URL. Direct `fetch(url)` of such URLs is unsafe. * * @module utils/safeFetch */ import type { SafeDownloadOptions } from "../types/index.js"; /** * Safely download a binary asset from an external URL. * * @throws {Error} if the URL is unsafe, the response is too large, a redirect * is encountered, or the HTTP status indicates failure. */ export declare function safeDownload(url: string, options: SafeDownloadOptions): Promise;