import { fetch as undiciFetch } from 'undici'; /** * Modules can contribute additional allowed hosts beyond the env variable — the * cms module registers one that derives the active cloud file-storage host * (S3 bucket / Azure account / GCS / CDN base URL) from configuration, so * operators * don't have to duplicate it in `IMAGE_ALLOWED_HOSTS`. Providers run on every * check; one that throws is skipped so a misconfigured provider can never take * image serving down. */ type AllowedImageHostsProvider = () => string[]; export declare function registerAllowedImageHostsProvider(provider: AllowedImageHostsProvider): void; /** * Hosts the image proxy (`/images?src=…`) is allowed to fetch from: the * `IMAGE_ALLOWED_HOSTS` environment variable (comma-separated) plus any hosts * contributed by registered providers. This is a strict allowlist: any host * not listed — public or private — is refused. It both blocks SSRF (loopback, * link-local metadata, private ranges, …) and stops the endpoint from being * abused as a free image-optimization proxy for arbitrary third-party images. * When the env variable is unset and no provider contributes a host, no * external host is allowed (only local media/public/theme images are * processed). */ export declare function getAllowedImageHosts(): string[]; /** * Parse and validate an untrusted image URL: http/https only, and the host must * be on the `IMAGE_ALLOWED_HOSTS` allowlist. Returns the parsed URL. */ export declare function assertAllowedUrl(rawUrl: string): URL; /** * `fetch` for untrusted, user-supplied image URLs. Only hosts on the * `IMAGE_ALLOWED_HOSTS` allowlist may be reached (every redirect hop included), * restricted to http(s), with a request timeout to guard against hanging hosts. */ export declare function secureFetch(rawUrl: string, init?: Parameters[1]): Promise>>; export {};