Interface SandboxConfig

Configuration for the sandbox environment.

interface SandboxConfig {
    timeoutMs?: number;
    maxMemoryBytes?: number;
    maxOutputBytes?: number;
    envVars?: Record<string, string>;
    workingDir?: string;
    allowNetwork?: boolean;
    allowFilesystem?: boolean;
    allowedPaths?: string[];
    blockedModules?: string[];
    maxCpuTimeMs?: number;
    extraGlobals?: Record<string, unknown>;
}

Properties

timeoutMs?: number

Maximum execution time in milliseconds

maxMemoryBytes?: number

Maximum memory in bytes

maxOutputBytes?: number

Maximum output size in bytes

envVars?: Record<string, string>

Environment variables to inject

workingDir?: string

Working directory for execution

allowNetwork?: boolean

Whether to allow network access

allowFilesystem?: boolean

Whether to allow filesystem access

allowedPaths?: string[]

Allowed filesystem paths (if allowFilesystem is true)

blockedModules?: string[]

Blocked imports/modules

maxCpuTimeMs?: number

Maximum CPU time in milliseconds

extraGlobals?: Record<string, unknown>

Extra global bindings to inject into the sandbox context alongside the minimal defaults. Use this when a higher-level wrapper (such as SandboxedToolForge) needs to expose allowlisted APIs (fetch, fs, crypto) without forking a second sandbox implementation.

Security-critical keys are silently dropped from this map at merge time so callers cannot accidentally undo the sandbox's minimal defaults:

  • Host-state escape: process, global, globalThis, require
  • Code-generation reflection: eval, Function
  • Realm-reflection / introspection: Reflect, Proxy
  • Memory side-channels (Spectre family): SharedArrayBuffer, Atomics
  • Native compilation surface: WebAssembly