export interface SandboxOptions { timeoutMs?: number; memoryLimitMb?: number; } /** * Operator opt-in env var that allows {@link runInWorker} to execute on Node.js * despite the lack of permission isolation. Read via {@link getHostEnv} so that * a per-request project env overlay cannot enable unsafe execution from inside * a tenant context. * * @internal Exported for testing. */ export declare const NODE_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE"; /** * Pure decision helper for the Node.js sandbox guard. Given the raw env-var * value, decide whether to block execution on Node. * * Returns `true` only when the value is the literal string `"1"`. Any other * value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the * guard active. Strict equality is intentional for a security opt-in. * * @internal Exported for testing only. */ export declare function isNodeSandboxAllowedUnsafe(envValue: string | undefined): boolean; /** * Operator opt-in env var that allows {@link runInWorker} to execute on Bun * despite the lack of permission isolation. Read via {@link getHostEnv} so that * a per-request project env overlay cannot enable unsafe execution from inside * a tenant context. * * @internal Exported for testing. */ export declare const BUN_SANDBOX_ALLOW_UNSAFE_ENV = "VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE"; /** * Pure decision helper for the Bun sandbox guard. Given the raw env-var * value, decide whether to block execution on Bun. * * Returns `true` only when the value is the literal string `"1"`. Any other * value (including `"true"`, `"yes"`, whitespace, or empty string) keeps the * guard active. Strict equality is intentional for a security opt-in. * * @internal Exported for testing only. */ export declare function isBunSandboxAllowedUnsafe(envValue: string | undefined): boolean; /** * Run untrusted JavaScript in an isolated Worker. * * ## Isolation model * * - **Deno (recommended):** the worker is spawned with `permissions: "none"`, * denying filesystem, network, env, and subprocess access. This is the * primary safe execution path. * - **Node.js:** Node Workers do not support permission isolation. They * inherit full access to the filesystem, network, env vars, and built-in * modules. Only memory limits can be enforced. Because of this, the Node * path is **disabled by default** and throws {@link NOT_SUPPORTED}. * Operators who deliberately trust their input may set the env var * `VERYFRONT_NODE_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard. * - **Bun:** Bun Workers have the same lack of permission isolation as Node.js. * The Bun path is **disabled by default** and throws {@link NOT_SUPPORTED}. * Operators who deliberately trust their input may set the env var * `VERYFRONT_BUN_SANDBOX_ALLOW_UNSAFE=1` to bypass the guard. * * Callers SHOULD NOT pass untrusted code to this function on Node.js or Bun * unless they have audited every caller and operator and accept the risk. * * @throws NOT_SUPPORTED on Node.js without the explicit opt-in env var. * @throws NOT_SUPPORTED on Bun without the explicit opt-in env var. */ export declare function runInWorker(code: string, options?: SandboxOptions): Promise; //# sourceMappingURL=deno-sandbox.d.ts.map