Vibeleaderboard
← All Intel
Intel / article

How to Run Untrusted Code Safely

Source
fly.io
Date

Context

Fly.io's guide to running untrusted code argues that code written by an , or submitted by a user, needs two boundaries that an ordinary container does not supply. A container gives a program its own view of files and processes, but every container on a machine shares the host's kernel, the core of the operating system that controls memory, devices and permissions. A flaw in that shared kernel can let code escape the container and reach the host. The post points to NIST's container security guide (SP 800-190), which ranks container escapes among the most critical threats, and to MITRE ATT&CK, which catalogs the technique as T1611. Its first requirement is therefore hardware isolation: the code runs inside a virtual machine with a kernel of its own instead of the one everything else on the machine depends on.

The second boundary is the network. Code that cannot touch your files can still send data to an attacker's server, download further malicious programs, take instructions from a remote controller or simply spend your computing budget. The post says outbound connections should be blocked unless explicitly allowed, and that the rules should be enforced from outside the so the code cannot loosen them. In its example, a deny-all policy is set through the Sprites API: DNS lookups are refused, direct connections to IP addresses are blocked, and the post says even code with root access inside cannot change the policy. A narrower version allows only the OpenAI and Anthropic API domains. Vercel's description of its own sandbox makes the same case that isolation without control over outgoing traffic leaves an exit open, and it names a reachable DNS resolver as one path that can let code out of an otherwise disconnected environment.

The rest of the post is a tutorial for Sprites, Fly.io's own sandbox product. It adds two more requirements, rollback and support for many programming languages, and shows Sprites meeting them: a damaged Sprite can be destroyed and replaced, or restored from a checkpoint in about a second by the post's account, and common language runtimes come preinstalled. Sprites also sleep when idle, so the post says a code runner costs nothing between jobs. The post presents these as product features and offers no escape tests or measurements, and it does not explain how Sprites implement hardware isolation. Its useful contribution is the checklist itself: a separate kernel, and network rules the code cannot rewrite, are the two questions to ask of any sandbox, from Fly.io or anyone else.

Key takeaways · AI-distilled
  • Fly.io argues containers are not enough for truly untrusted code because they share the host kernel, so one kernel exploit escapes. It cites NIST SP 800-190 and MITRE ATT&CK T1611 and says such code needs hardware isolation with a dedicated kernel.
  • Filesystem isolation alone still lets code exfiltrate data, download payloads, reach command-and-control servers or spend your compute, so the post treats outbound network control as mandatory and calls for allowlists rather than denylists.
  • The post's key design point: the sandbox network policy is set from outside through the Sprites API, so code inside, even running as root, cannot change its own permissions. Under deny-all, DNS queries return REFUSED and raw IP connections are blocked.
  • For recovery the post relies on disposability: destroy a damaged Sprite and start a fresh one, or, when reusing one sandbox for many runs, checkpoint a known-good state and restore it in about a second.
Terms in this piece · Glossary
  • AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
  • sandbox — An isolated environment where AI-generated code or agent actions run without being able to touch anything real.
Recommended reads
Comments

Checking sign-in…

Loading comments…