//#region extensions/crypto/src/services/endpoint-allowlist.d.ts /** * Endpoint Allowlist — restrict outbound HTTP requests to approved hosts. * * Inspired by IronClaw's endpoint allowlisting pattern. * Prevents prompt injection attacks from tricking the agent into * exfiltrating data to attacker-controlled URLs. * * Usage: * import { guardedFetch, isAllowedEndpoint } from './endpoint-allowlist.js'; * * // Use guardedFetch as a drop-in replacement for fetch() * const resp = await guardedFetch('https://api.0x.org/swap/v1/quote?...'); * * // Or check manually before calling fetch * if (!isAllowedEndpoint(url)) throw new Error('Blocked'); */ /** * Check if a URL targets an allowed host. * Returns true if the host is in the allowlist. */ declare function isAllowedEndpoint(urlOrHost: string): boolean; /** * A guarded fetch wrapper that blocks requests to non-allowlisted hosts. * Drop-in replacement for global `fetch()`. * * Security features: * - Blocks requests to non-allowlisted hosts * - Prevents redirect-based allowlist bypass (redirect: 'manual') * - Mode locked at startup (cannot be changed via env injection) */ declare function guardedFetch(input: string | URL | Request, init?: RequestInit): Promise; /** * Add a host to the runtime allowlist (does not persist across restarts). * Useful for dynamically discovered endpoints (e.g., user-configured RPC URLs). */ declare function addAllowedHost(host: string): void; /** * Get the full list of allowed hosts (for diagnostics). */ declare function getAllowedHosts(): string[]; /** * Get the current allowlist mode. */ declare function getAllowlistMode(): string; /** * Re-read the allowlist mode from the current env. * ONLY for use in tests — production code should never call this * (the mode is locked at startup to prevent runtime env injection). */ declare function _resetAllowlistMode(): void; declare class EndpointBlockedError extends Error { readonly blockedUrl: string; constructor(url: string); } //#endregion export { EndpointBlockedError, _resetAllowlistMode, addAllowedHost, getAllowedHosts, getAllowlistMode, guardedFetch, isAllowedEndpoint }; //# sourceMappingURL=endpoint-allowlist.d.mts.map