Skip to content

Sandbox

Luis edited this page Dec 2, 2026 · 5 revisions

Sandbox

Summarizes ADR 0016 (runtime, profile, network, build), ADR 0019 (PoC runner) for main. If they disagree, the ADRs win.

The sandbox is optional. Without it creep scans as in v0.1: findings stay probable, and nothing runs in a container. With it, a nightly scan can raise a finding to verified by running a proof of concept (PoC) against the app the repository builds. A pr scan never uses it.

Turning it on

Key Default Where it may be set
sandbox.enabled false user file (~/.creep/config.yaml), --config file or the org policy (CREEP_POLICY); never the project's creep.yaml
sandbox.runtime docker same; docker or podman. The runtime checked first; detection still picks the strongest isolation
# ~/.creep/config.yaml (or the CI policy)
sandbox: { enabled: true }

Then creep doctor lists each runtime it found, the one a scan would use, its rootless status and isolation level, and the two pinned images it needs (BusyBox for the canary and runner, PostgreSQL for the synthetic database) with the pull command for a missing one. creep never pulls an image: pull them yourself with the command doctor prints, which targets the same engine creep checked (docker --host=<endpoint> pull <ref> or podman --remote=false pull <ref>).

Engine versions

A runtime is usable only with a patched engine, because older ones let a build escape through links a Dockerfile check cannot see (CVE-2024-21626, CVE-2024-1753, CVE-2024-23652; ADR 0016, #311):

Runtime Minimum
Docker Docker Engine >= 25.0.2 (it embeds BuildKit 0.12.5) whose default runtime is runc >= 1.1.12
Podman Buildah >= 1.35.3, and runc >= 1.1.12 or crun >= 1.4.4

creep reads the versions offline from the engine it checked (docker version, docker info's DefaultRuntime, podman info). Below a minimum is old_runtime; a missing, unparsable or doubled version, or another OCI runtime, is unknown_version. Either makes the runtime unusable: creep doctor names the reason, a scan builds nothing (no_runtime, findings stay probable) and creep reproduce exits 3. A distribution that backported the fixes to an older version is refused, since creep can read only the version.

Only creep scan --mode nightly (or a GitHub Actions schedule event) and creep reproduce use the sandbox. See Verification statuses for what it changes in the report and CI with the Action for the gates.

What runs where

What Where Network
creep itself, redaction, the planner, report writing host only the gateway, only to egress.allow hosts
model calls (HTTP or a model CLI) the configured endpoint, or the model CLI in an empty private directory on the host, started only by the gateway the model's own; every call logged in .creep/egress.log
gitleaks, osv-scanner (when enabled) host, offline none
the docker or podman CLI host, started only by internal/sandbox, fixed argv, no shell, filtered environment local socket or named pipe only
the app build the container engine's builder, from the repository's own root compose file or Dockerfile --network=none; base images must already be local
the app a container on the run's internal network creep-<run>, as app internal network only, no published port
the synthetic database a PostgreSQL container on the same network, as db, starts empty (since v0.6, #364), data on tmpfs, synthetic credentials internal network only
the network canary a BusyBox container, before every PoC batch and before the database starts must fail to reach a public IP and resolve a public name, or the run aborts
PoC requests a BusyBox runner container that sends creep's rendered request bytes with nc to app:<port> internal network only
the database marker lookup a psql client container with a fixed query internal network only

What never happens: model output is never executed, on the host or anywhere (invariant 4). The model picks a closed PoC template and typed parameters; creep renders the HTTP request bytes itself, with no host, scheme or port the model can choose (ADR 0019). The host never connects to the app; no container mounts the runtime socket or host credentials.

Every container runs with --rm, --pull=never, no network unless it joins the run network, --cap-drop=ALL, no-new-privileges, a read-only root with a small noexec /tmp, user 65534:65534, 128 pids, 512 MB memory, 1 CPU, private IPC, no log driver, and empty proxy variables. Mounts are read-only single files from creep's own 0700 work directory.

The build is the repository's code, so it is treated as hostile: offline (--network=none, no pull, no build arguments, secrets or SSH), a staged context without .env files, .git or credential files, a 15-minute timeout, and a compose file or Dockerfile feature that could escape (privileged or host-network services, host volumes, remote contexts, build secrets, ADD of a URL, a # syntax= frontend) refuses the build. A refused or failed build is verification unavailable, never a failed scan. Residual: build steps run with the builder's defaults (root in the build container, no creep resource limits), bounded only by the timeout.

The app must declare its port with EXPOSE, or verification is unavailable (no_port). The run's database is PostgreSQL and starts empty. Since v0.6 (#364, #374) the app gets creep's synthetic settings (DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE) as environment variables and as a read-only .env mounted in its working directory, never on a container command line. The app sets up its own schema: a root compose migrate service with a command list (["python", "migrate.py"], ["alembic", "upgrade", "head"]) runs once in the built app image, with the same hardening, after the database is ready and before the app starts; .sql files no longer seed it by themselves. The Live verify workflow checks this nightly on testdata/apps/flaskpg (Flask and PostgreSQL, offline wheels): its SQL injection and path traversal must verify 5 of 5 and its safe twin nothing.

Isolation levels

Detection accepts a runtime only if it runs Linux containers, seccomp is on and not unconfined, and memory, pids and CPU limits work. Among usable ones it picks the strongest isolation (the configured sandbox.runtime wins a tie):

Level What it is creep
rootless Docker rootless or Podman rootless: the engine runs as your user preferred
vm Docker Desktop: the daemon runs in a VM accepted
rootful a root daemon on the host accepted, creep doctor warns; a container escape would be root on the host (accepted residual, threat model X4)

A runtime is refused, with a reason ID in creep doctor, when: it is not on PATH (not_found), resolves to the current directory or a relative PATH entry (relative_path) or into the repository (in_repository), is not an .exe on Windows (not_exe), uses a remote endpoint (remote_endpoint: any tcp:// or ssh:// Docker host or context, a pipe on another machine, a remote Podman service), has a bad DOCKER_CONTEXT (bad_context), is not running (not_running), answers malformed info (malformed_info), runs Windows containers (not_linux), has no seccomp (no_seccomp) or cannot apply limits (no_limits). With no usable runtime the scan still runs; a nightly scan then reads its gate at probable.

Podman for enterprises

Podman is supported as a rootless, daemonless alternative where Docker Desktop is not licensed or a root daemon is not allowed. Be aware of its status:

  • Podman is untested. No Podman run has been confirmed end to end on a real engine; the project's CI and development machines use Docker. Every Podman command line creep builds (info, image inspect, run, network, build, ps, rm) was reviewed against podman --help and is pinned by the same protection tests as Docker's (hardened profile, offline build, no published port). The integration tests run on Podman wherever a usable Podman exists, and skip otherwise.
  • It fails closed. Podman runs only locally: outside Linux (podman machine on macOS or Windows), or with CONTAINER_HOST or CONTAINER_CONNECTION set, it is refused without being started (remote_endpoint); every call carries --remote=false; a service that still reports serviceIsRemote is refused. Rootful Podman gets no run network (its bridge would be reachable from the host), so no PoC runs there and verification is unavailable; use rootless Podman.
  • Podman also gets --http-proxy=false, so host proxies never reach containers, and fully qualified image references, so it never resolves a short name. A containers.conf env entry is your own setting and still reaches containers.

For a fleet: install rootless Podman, set sandbox: { enabled: true, runtime: podman } in the org policy, pull the two pinned images from a registry or mirror you trust (the digest must match, or the run fails), and check creep doctor on one machine first. If doctor reports Podman not usable, creep falls back to a usable Docker or runs without verification; it never weakens the profile to make Podman work. Report what you see on Podman in an issue.

Cleaning up

Every container, app image and network carries creep's labels and run ID and is removed when the run ends, also on Ctrl+C. After a killed run, creep clean removes everything creep left on local Docker or Podman, from any run (exit 0 when all reachable runtimes were cleaned, 3 when a removal failed). It also removes the containers of a run still in progress.

All sandbox rules

Moved from the README (2026-12-02): every sandbox rule in one list, including the build mirror, when the build runs, PoCs, the migrate step and the test apps.

The sandbox is optional, and only a nightly scan uses it (ADR 0021). Without a usable runtime, scans run as before and findings stay probable.

  • Runtime. creep doctor lists Docker and Podman with their isolation (rootless first, then a Docker Desktop VM, then a rootful daemon, which it warns about). Only a local socket or named pipe is used, never a tcp:// or ssh:// endpoint (ADR 0016).
  • Containers. Every container runs with no network, no capabilities, a read-only root, user 65534, pids, memory and CPU limits and a timeout, and never mounts the Docker socket or host credentials. The repository's .env never reaches a container (the build context leaves them out); the app gets only creep's synthetic database settings (DATABASE_URL, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE), as environment variables and as a read-only .env in its working directory.
  • Run network. PoCs and a synthetic PostgreSQL that starts empty share one --internal network per run, creep-<run>, with no published port; before each PoC batch a canary container must fail to reach a public IP and to resolve a public name, or the run aborts. Rootful Podman gets no network (its bridge is reachable from the host).
  • Engine versions. A runtime is usable only with Docker Engine >= 25.0.2 (it embeds BuildKit 0.12.5) whose default runtime is runc >= 1.1.12, or Podman with Buildah >= 1.35.3 and runc >= 1.1.12 or crun >= 1.4.4: older engines let a build escape through links a Dockerfile check cannot see (CVE-2024-21626, CVE-2024-1753, CVE-2024-23652), and crun < 1.4.4 gave containers inheritable capabilities (CVE-2022-27650). creep reads the versions offline from the runtime; a version below a minimum is old_runtime, a missing, unparsable or other OCI runtime is unknown_version, and either makes the runtime unusable: creep doctor names the reason, a scan builds nothing (no_runtime) and creep reproduce exits 3. A distribution backport to an older version is refused (ADR 0016).
  • Images. creep never pulls images: creep doctor lists the two digest-pinned images it needs (BusyBox for the canary and the PoC runner, PostgreSQL) and, for a missing one, the pull command for the endpoint it checked (docker --host=<endpoint> pull <ref>, or podman --remote=false pull <ref>).
  • App build. The app image is built only from the repository's own root compose file or Dockerfile, never a generated one and never through docker compose, and the build is offline: --network=none, base images must already be present, no build arguments or secrets, and the build context is a copy without .env files, .git or credential files. A compose or Dockerfile feature that could escape (privileged or host-network services, host volumes, remote contexts, build secrets, ADD of a URL, a # syntax= frontend) refuses the build, and any refused or failed build means verification unavailable, never a failed scan.
  • Build mirror. On rootless Podman, a build that installs packages can reach them through a mirror the operator runs (ADR 0029): create an internal network (podman network create --internal --ipv6=false creep-mirror), attach your registry mirror or allowlisting proxy to it, and set sandbox.mirror.bridge: creep-mirror and, for a proxy, sandbox.mirror.proxy: http://<proxy>:<port> in the user file, --config or policy (never ./creep.yaml). Before each build creep checks the network is an internal IPv4 bridge and runs the canary on it, which must reach nothing public; RUN steps then join it and get the proxy as HTTP_PROXY/HTTPS_PROXY. Base images still come only from the local store, every Dockerfile and engine check still applies, and the app never runs on that network. Docker's BuildKit cannot run a build on such a network, so with Docker, rootful Podman or a network that fails a check the build is mirror_refused (verification unavailable, never a failed scan). Without these keys the build stays offline.
  • When it runs. With sandbox.enabled: true (user or policy config only; the project file cannot set it) and a usable runtime, a nightly scan (creep scan --mode nightly, CI) builds the app once, after the analysis and within the scan deadline, from the scan's own file list, and removes the image when it ends; a pr scan never builds it. The report (text, Markdown and SARIF; JSON v1 does not change) says whether the app was built or why verification is unavailable, as a closed reason such as no_build_file, dockerfile_refused, base_image_missing, build_failed or no_runtime; the build never fails the scan or makes it incomplete, and in a nightly scan a verification that did not run reads the nightly gate at probable.
  • PoCs. With an app built, the scan asks the model for one PoC per probable sqli, path_traversal or template_injection finding (at most 16), as a closed template creep owns (ADR 0019), and runs it 5 times in the sandbox, each time with a fresh nonce: 5 of 5 is verified, 1 to 4 of 5 verified with its rate (verified in 3/5 runs, intermittent, in the text, Markdown and SARIF reports; JSON v1 reads verified), and 0 of 5 leaves the finding probable, since the app is the repository's own and could fail a PoC on purpose. The app must declare its port (EXPOSE), or verification is unavailable (no_port).
  • Schema. The app sets up its own schema: when the root compose file has a migrate service with a command list (command: ["python", "migrate.py"], ["alembic", "upgrade", "head"], ["npx", "knex", "migrate:latest"]), creep runs that command once in the app image it built, inside the sandbox with the same hardening, after the database is ready and before the app starts; nothing of that service but its command is read. A string command, an entrypoint, extends or no command skips only that step, with the reason printed (string_command, entrypoint, extends, no_command). Otherwise the app must create its schema when it starts. .sql files in migrations/, db/migrations/, Prisma's and the other fixed folders never seed the database by themselves; apply them from the migrate command (a framework's migrate tool, or ["psql", "-f", "migrations/001_init.sql"] when the image ships psql; it reads the PG* variables creep sets), or findings that need those tables stay probable.
  • Bundles. Each verified finding gets a reproduction bundle, .creep/bundles/<id>.json (the PoC, every request and response, the image IDs, the commit, the migrate command's digest and the timings), redacted like everything the scan sends; creep reproduce <id> runs it again with no model (ADR 0020).
  • Test apps. Each app in testdata/apps ships one Dockerfile, from the pinned BusyBox, that only copies its files, except flaskpg: a Flask app on a digest-pinned Python image that installs its committed wheels offline and runs its own migrate step. Its committed wheels are for linux/amd64 (CPython 3.13), so it builds only on an amd64 engine. The Live verify workflow scans it nightly with the sandbox and fails unless its SQL injection and path traversal are verified 5 of 5 and nothing is verified on its safe twin. Its model answers are synthesized in the test (the reader's claims and the PoCs of the committed PoC fixtures), not replies recorded from a live model: #356 recorded the reader and discovery live at tier S, but this workflow's verification path still runs on synthesized answers.

Clone this wiki locally