Mendloop Docs Request access

The fix sandbox

Build and test fixes on your own server in a throwaway, offline Docker container.

With the sandbox on, Mendloop builds and tests your code before opening a pull request, in a throwaway Docker container that holds your repository at the exact commit the fix starts from. It is removed as soon as the run ends.

The sandbox is optional. With the default SANDBOX_DRIVER=ci-only, Mendloop doesn't run your code at all and relies on your CI. Set SANDBOX_DRIVER=docker to turn the sandbox on. Mendloop still needs only Postgres and Redis; Docker is an extra.

What runs where#

  1. On the Mendloop worker: git fetches only the one commit the fix starts from, with a short-lived GitHub token. The token is never put in a command line, a file, a log or the container.
  2. Mendloop picks a toolchain (below), copies the files into a new Docker volume, and deletes its own copy.
  3. In the sandbox: the install, build and test commands run one by one, as a normal user.
  4. Mendloop collects each command's exit code and output (shortened if long, secrets masked).
  5. Always, even on errors: the container, its volume, its network and any temporary files are deleted.

What is isolated#

User Commands run as uid 1000, never root. No extra Linux capabilities, no privilege escalation.
Files The system is read-only. Only the repository (/workspace/repo) and /tmp are writable. Nothing from the host is mounted, and never the Docker socket.
Network Off by default. The sandbox sits on its own private network with no way out.
Install step Can reach only the package registries for your toolchain (and hosts you add), through a small proxy that refuses every other host. The proxy is removed right after the install step, so builds and tests run offline.
Limits CPU, memory (no swap), number of processes, /tmp size, time per command, total lifetime, output size.

Not limited today: disk used inside the volume. Kernel isolation is standard Docker; Mendloop Cloud adds gVisor.

How the toolchain is picked#

  1. If the repository has .devcontainer/devcontainer.json (or .devcontainer.json) with an "image", that image is used. Devcontainers that build their own Dockerfile are not built; the next rule applies.
  2. Otherwise the first lockfile found decides: pnpm-lock.yaml, yarn.lock, package-lock.json (Node); uv.lock, poetry.lock, Pipfile.lock, requirements*.txt (Python); go.mod (Go); Gemfile.lock (Ruby); pom.xml, build.gradle (Java). Then package.json or pyproject.toml alone.
  3. Nothing found: a plain Debian image.
Toolchain Image Registries the install step may reach
node node:22-bookworm-slim registry.npmjs.org, registry.yarnpkg.com, repo.yarnpkg.com
python python:3.12-slim pypi.org, files.pythonhosted.org
go golang:1.23-bookworm proxy.golang.org, sum.golang.org, storage.googleapis.com
ruby ruby:3.3-slim rubygems.org, index.rubygems.org, rubygems.global.ssl.fastly.net
jvm maven:3.9-eclipse-temurin-21 repo.maven.apache.org, repo1.maven.org, Gradle plugin and distribution hosts
generic debian:bookworm-slim none

Images are pulled the first time they are needed.

Settings#

All settings go in the server's environment.

Setting Default What it does
SANDBOX_DRIVER ci-only docker turns the sandbox on
SANDBOX_DOCKER_HOST auto Docker address (unix:///var/run/docker.sock or tcp://…). Empty: DOCKER_HOST, then the usual sockets
SANDBOX_IMAGES built in JSON to replace any image, e.g. {"node": "node:20-bookworm-slim"}. Pin by digest if you like
SANDBOX_ALLOWED_HOSTS none More hosts the install step may reach, comma separated, e.g. npm.corp.example,*.artifacts.corp.example
SANDBOX_CPUS / SANDBOX_MEMORY_MB / SANDBOX_PIDS 2 / 4096 / 512 Resource limits
SANDBOX_TMPFS_MB 1024 Size of /tmp (also the home folder)
SANDBOX_COMMAND_TIMEOUT / SANDBOX_MAX_LIFETIME 600 / 3600 s Time per command / for the whole sandbox
SANDBOX_OUTPUT_BYTES 1000000 Output kept per command (start and end are kept; the middle is cut)
SANDBOX_USER 1000:1000 uid:gid commands run as
SANDBOX_PROXY_IMAGE python:3.12-alpine Image for the allow-list proxy (needs python3)
SANDBOX_REAP_AFTER_MINUTES 90 Leftovers older than this (for example after a crash) are removed

If the worker runs in Docker#

Warning:

The worker needs a Docker daemon to start sandboxes, which means mounting the host's Docker socket into the worker container (never into a sandbox). Anyone who controls the worker then controls the host's Docker. Keep the worker on a machine you trust, or point SANDBOX_DOCKER_HOST at a separate Docker host used only for sandboxes.

No shared folders are needed: files go in and out through the Docker API. The Docker sandbox also needs more memory than ci-only; see Sizing.

Checking it#

  • With SANDBOX_DRIVER=docker and no reachable daemon, the sandbox reports "Docker daemon not reachable at …" and the fix step falls back to your CI.
  • Find leftovers with docker ps -a --filter label=mendloop.sandbox=1; there should be none between runs. The shared mendloop-sandbox-egress network stays; it is reused.