Cortheon executes model-generated Python code during verification (ReasonForge, CodeForge, ThinkForge) and runs commands inside repositories during experimental agent modes (agent, dev).
By default, run_python(...) executes untrusted model-written code inside an isolated ephemeral temporary directory with OS-level containment:
| Platform | Default Backend | Protections Enforced |
|---|---|---|
| macOS | macos-seatbelt (/usr/bin/sandbox-exec) |
Denies all network access (deny network*); denies all filesystem writes outside the ephemeral temp directory (/dev/null, /dev/tty, /dev/dtracehelper excepted); denies reads of sensitive user credential and harness home paths (~/.ssh, ~/.aws, ~/.gnupg, ~/.kube, ~/.config, ~/.netrc, ~/.omp, ~/.pi, ~/.dsh, ~/.claude, ~/.codex, ~/.cursor); scrubs secret env vars; enforces RLIMIT_CPU, RLIMIT_FSIZE (64 MiB), and hard process-group SIGKILL timeout. |
| Linux | linux-bwrap (Bubblewrap, when on PATH) |
run_python (ReasonForge, CodeForge, SpecVerify, probes, guard's Python reproducers) uses an allow-list: --unshare-all (network, PID, IPC, UTS, user namespaces) and --new-session; read-only mounts of only /usr, the /bin and /lib links, ld.so.cache and the interpreter's own install or venv; a fresh tmpfs /tmp; the per-run temp directory as the only writable path; extra directories only when a caller names them in ro_paths (read-only; never / or the home directory itself). The home directory, /run (user D-Bus and systemd sockets), /var/run/docker.sock and other processes are not visible. HOME=/nonexistent, a minimal environment, RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_AS (4 GiB, omitted for ASan/compiled-toolchain runs that reserve large virtual shadow mappings) and a hard process-group SIGKILL timeout. Known limitation: cortheon guard's Node, shell and Go reproducers (flash_forge/guard.py) still use the older --ro-bind / / + --unshare-net profile: they cannot write outside their temp directory or reach the network, but they can read host files and connect to host Unix sockets. Run guard on untrusted diffs only inside a container or VM. |
Fallback (Linux without bwrap / Windows) |
subprocess-rlimit |
Isolated temp directory, secret env var scrubbing, POSIX RLIMIT_CPU + RLIMIT_FSIZE (where supported), hard timeout. Does not isolate network or host filesystem reads — install bwrap or run inside a container/VM. |
Check your active backend at any time:
python -c "from flash_forge.sandbox import sandbox_backend; print(sandbox_backend())"Verified automatically in tests/test_sandbox_security.py (mechanically asserting blocked outbound sockets, blocked out-of-directory writes, blocked credential reads, and scrubbed secrets).
To disable OS sandboxing explicitly (for debugging inside an already-isolated container or VM):
export CORTHEON_UNSAFE_NO_SANDBOX=1cortheon agent and cortheon dev execute shell/test commands against a real repository or ephemeral git worktree. While read-only mode locks down shell=False command allowlists and dev isolates edits in temporary git worktrees, always run autonomous agent modes inside a container, VM, or disposable repository clone — never against production credentials or unbacked-up trees.