Sandboxing

Running untrusted code in a small, disposable environment that cannot freely reach your files, network, credentials, or operating system.

run this code without letting it touch my machinesafe box for untrusted codekeep the plugin away from my fileswhere do I run code my users wrotequarantine the processlet it run but give it nothingsand boxingsanboxing

See it

Live demo coming soon

What it is

A sandbox gives untrusted code a deliberately small world: limited files, memory, CPU, processes, syscalls, devices, and network access. If the code crashes, loops forever, or tries to read a secret, the boundary should contain the damage. Chrome's Site Isolation is the version a billion people use without noticing: every site gets its own renderer process that cannot read the filesystem directly. Code runners reach further, using gVisor or Firecracker microVMs for a stronger boundary than an ordinary process.

Use one for uploaded document conversion, user-written code, plugins, build jobs from untrusted pull requests, and risky parsers. Start with nothing allowed, then grant a temporary working directory, exact input files, bounded resources, and only the network destinations the task requires. Destroy the environment after each job.

A default container is not a security boundary. A container shares the host kernel, may run as root, and often keeps outbound internet access, mounted credentials, and the cloud metadata endpoint. Layer isolation with a non-root user, syscall filtering, resource limits, an empty credential set, blocked egress, and a patched runtime. Sandbox escapes exist, so the host must still assume the guest is hostile.

Ask AI for it

Build an isolated runner for untrusted jobs using gVisor `runsc`. Give each job a fresh container, a non-root user, a read-only root filesystem, a size-limited temporary directory, no host mounts, no Linux capabilities, no credentials, and no outbound network access. Set hard CPU, memory, process-count, output-size, and wall-clock limits; kill the full process tree on timeout and destroy the container after every run. Block `169.254.169.254` explicitly, keep the default seccomp policy, validate input and output paths against traversal, and add tests for reading a host file, opening a socket, forking until the PID limit, writing past quota, and exceeding the timeout.

You might have meant

containerizationleast privilegetenant isolationssrfattack surface

Go deeper