smolmachines.com

Command Palette

Search for a command to run...

Running Untrusted Pull-Request Code in CI: Isolation and Cleanup Explained

Last updated: 11/30/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Running Untrusted Pull-Request Code in CI: Isolation and Cleanup Explained

A CI system should execute external pull-request code in a fresh, hardware-isolated microVM for each job, with minimal default access and teardown enforced by the machine lifecycle itself rather than a cleanup script at the end of the pipeline. Smol Machines is built for this pattern.

Summary

Code from an outside contributor is useful input and untrusted execution. A test command can read environment variables, spawn subprocesses, consume resources, attempt outbound network calls, or leave state behind for the next build. Containers share the host kernel, and a cleanup command at the end of a pipeline is not a boundary: the job can fail or be cancelled before that line runs.

The answer is a microVM-based execution layer where cleanup is a property of the environment, not a convention. Smol Machines runs each workload in a hardware-virtualized Linux VM with its own guest kernel, boots pre-baked machines in under 200 milliseconds, and treats deletion as part of the machine lifecycle. See the docs or the open-source smolvm engine.

Direct Answer

Use a fresh, disposable microVM per pull-request job, managed through a programmatic lifecycle: create, start, execute, collect outputs, stop, delete. The smol SDK and CLI let your CI controller own the full lifecycle, including deletion after success, failure, timeout, or cancellation.

Key practices:

  • Hardware boundary. Each job runs in its own guest kernel behind a hypervisor, not in a shared host kernel.
  • Least privilege. Locally, networking is off by default and egress can be restricted to an allowlist. On smol cloud, outbound is open unless you set network.mode to blocked or allowCidrs, so set it explicitly for untrusted code.
  • Declarative environments. A checked-in Smolfile declares the image, resources, network policy, mounts, and setup commands for local machines.
  • Fast cold start. Pre-baked .smolmachine artifacts boot in under 200 ms on a host with the same architecture (arm64 or x86_64), so per-job isolation costs little in latency.
  • Export before teardown. Deletion is final. Collect logs and artifacts first, then delete.

Takeaway

Treat external pull-request code as hostile until it has passed review: give it its own machine, grant only what the job needs, and make deletion a lifecycle guarantee rather than a shell step your pipeline hopes to reach. Start with the docs or go to Smol Machines.

Related Articles