/**
 * @license
 * Copyright 2025 Steven Roussey <sroussey@gmail.com>
 * SPDX-License-Identifier: Apache-2.0
 *
 * SSRF-aware fetch wrapper.
 *
 * The browser default performs a static URL classification only and delegates
 * to `globalThis.fetch`. The Node/Bun entrypoints register a server-side
 * implementation (see `SafeFetch.server.ts`) that additionally resolves DNS,
 * classifies every resolved address, and pins the connection to a specific
 * IP via an undici Agent — this closes the DNS-rebinding gap.
 *
 * Callers pass `allowPrivate` to opt into private/loopback targets. The task
 * layer sets this flag based on whether the task has been granted the
 * `network:private` entitlement (via its dynamic `entitlements()`).
 */
export interface SafeFetchOptions extends RequestInit {
    /**
     * When true, requests to private/loopback/link-local/metadata hosts are
     * permitted. When false (default), such requests throw PermanentJobError
     * both at URL-classification time and (in the server impl) at DNS-resolution
     * time — defeating DNS rebinding.
     */
    readonly allowPrivate?: boolean;
    /**
     * When `allowPrivate` is true, additionally restrict private-host requests
     * (including redirect targets) to URLs matching at least one of these glob
     * patterns. Must match the patterns the task declared in its
     * `network:private` entitlement scope (see `urlResourcePattern`). When
     * `undefined`, no scope check is applied and the boolean `allowPrivate`
     * governs alone — legacy behavior for direct callers outside the task
     * layer.
     *
     * This closes the "compromised redirect escapes grant scope" SSRF gap:
     * the task-graph enforcer approves a narrow private-host scope at
     * preflight, and this field re-enforces that same scope on every redirect
     * hop so a Location header cannot pivot to a different private host or
     * port the task was never authorized to reach.
     */
    readonly privateResourceScopes?: readonly string[];
}
export type SafeFetchFn = (url: string, options: SafeFetchOptions) => Promise<Response>;
/**
 * Register a platform-specific SafeFetch implementation. The Node/Bun
 * entrypoints call this at module load time to install the DNS-resolving,
 * connection-pinning implementation from `SafeFetch.server.ts`.
 *
 * Returns the previously registered implementation so callers can safely
 * restore it after a temporary override.
 */
export declare function registerSafeFetch(fn: SafeFetchFn): SafeFetchFn;
/**
 * Returns the currently registered SafeFetch implementation.
 */
export declare function getSafeFetchImpl(): SafeFetchFn;
/**
 * Restores the default browser-safe implementation.
 */
export declare function resetSafeFetch(): void;
/**
 * SSRF-aware fetch. See {@link SafeFetchOptions} for the `allowPrivate` flag.
 * Throws `PermanentJobError` if the URL targets a private host without
 * permission, or (server impl) if DNS resolves to a private IP.
 */
export declare function safeFetch(url: string, options?: SafeFetchOptions): Promise<Response>;
//# sourceMappingURL=SafeFetch.d.ts.map