Skip to content

feat: Add Docker-backed executor with network-none and read-only root - #9

Open
ThomasHartDev wants to merge 2 commits into
mainfrom
thomas/feat/docker-runner
Open

feat: Add Docker-backed executor with network-none and read-only root#9
ThomasHartDev wants to merge 2 commits into
mainfrom
thomas/feat/docker-runner

Conversation

@ThomasHartDev

Copy link
Copy Markdown
Owner

Adds runInDocker behind the same RunResult contract as run and runInWorker. Each run is a disposable container with --network=none, a read-only rootfs (tmpfs /tmp), dropped capabilities, non-root uid, and no host env. Abort and timeout force-remove the named container before killing the CLI so guests cannot orphan.

Return-value transport: grants enter as JSON (functions/symbols/bigints refused before spawn). Results leave the guest via framed node:v8 serialize (AIRLOCK1:<base64>), host-deserialized with structured clone fidelity for NaN, Infinity, Map, Set, Date, and TypedArray — matching runInWorker. Non-cloneable values fail closed as status: "error", never a corrupted ok.

Live tests cover the contract, value fidelity, cgroup OOM (maxMemoryMb), and host-env / outbound-net / write / path escape attempts; they skip cleanly when Docker is unavailable.

runInDocker implements the same RunResult contract as run/runInWorker
inside a disposable container: no network, read-only rootfs, dropped
caps, and no host env. Named containers are force-removed on abort so
guests cannot orphan.
JSON.stringify mangled NaN/Infinity/Map/TypedArray while still
returning status ok. Guest results now use a framed v8.serialize
channel (AIRLOCK1:base64) so structured-clone types match the
worker contract; non-cloneable values fail closed.

Split docker live tests into contract, fidelity, OOM, and isolation
suites; document the transport in the README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant