sandbox-broker GitHub

what holds, and where it stops

Security

The design assumes that the code in a sandbox is hostile. Not buggy: steered by someone else. This page says what stands between that code and everything else, who trusts whom, how it was tested, and what is known not to hold.

What a sandbox cannot do

the code in a sandbox cannotbecause
Reach the host or another sandbox It runs in a virtual machine of its own, with a disk of its own and no network device. Its only links to the host are virtual sockets answered by three processes that parse everything and trust nothing it says.
Get hold of a credential By default none is placed in it (an operator may exempt named environment variables of a command, and then owns that key's risk). Upstream credentials live in one process on the host, and tokens that process mints are used there and never returned. The live proof ends by searching the guest's files and processes, and the gateway's log, metrics and audit, for any token: there is none.
Reach an address you did not allow Connections are asked for by hostname and matched against the sandbox's list on the host. Every address a name resolves to must be public: a name that points at your LAN or the host itself is refused even when it is on the list.
Pass as another sandbox or agent Identity is never something a caller says. It is which socket a connection arrived on and which user the kernel reports at the other end. Each sandbox's helpers run as a user of their own; headers that claim an identity are stripped, and refused if they arrive anyway.
Use more than its share CPUs, memory, disk and lifetime are fixed from outside. Every capability has limits in flight, per minute and per day, and agents share CPU budgets you set.
Act without a record Every command, file transfer, profile change and capability call is written to an audit on the host that the sandbox cannot reach.

The boundary

There is one boundary, and it is the virtual machine. Each sandbox is a Firecracker microVM on KVM, started by Firecracker's jailer as an unprivileged user that belongs to that sandbox alone, in a root and a control group of its own.

There is no second wall inside the guest. The sandbox user has sudo, on purpose: nothing depends on the guest's own permissions holding.

What the guest can talk to is as small as it could be made. No network device, no shared folder. Three virtual sockets, each answered by a process that does one job.

processruns as
the guesta user of its own, per sandbox, in a jail
its proxyone per sandbox, no privileges, a memory limit of its own
its capability frontone per sandbox, a user of its own, holds nothing
the gatewayits own user; refuses to start as root
the brokerits own user; holds no upstream credential and dials nothing on the network
the runnerroot, because the jailer needs it, bounded by its systemd unit

Who believes whom

Every hop checks the one before it by something the kernel reports, not by something in the message.

whobelievesbecause
The broker, of your toolingWhich agent it is, and nothing elseEach agent has a Unix socket of its own, and only the configured user may connect to it.
The runner, of the brokerWhat to start, stop and allowThe runner's socket admits the broker's user alone.
The gateway, of a call from a sandboxNothing but the user it came fromThe runner gave each sandbox's front a user of its own and registered it with the gateway before the front started. A stranger's connection is closed unread.
A tool, of the gatewayThe headers that say which sandbox is callingThe tool's socket admits the gateway's user alone, and a sandbox's own copies of those headers never get that far.
An API, of the gatewayThe credentialOnly the gateway holds it. A caller's own Authorization is never passed on.
Anything, of the guestNothingIt asks, and is answered or refused.

If something is taken

A useful way to read a design is to ask what each part's compromise would cost.

suppose an attacker controlsthen they hold
The code in a sandbox
the expected case
That sandbox's disk, the hostnames on its current profile, and its grants within their limits. Not the host, not another sandbox, not a credential.
Your agent's tooling
the client of the broker
That agent's sandboxes. It can choose among the profiles and grants the config names for that agent. It cannot write a new scope, raise a limit, reach another agent's sandboxes, or pass its group's budget.
A tool behind a capability Whatever that tool holds itself, and the trust of the sandboxes that call it. Nothing of the gateway's.
The gateway Every upstream credential: the GitHub App's key, and with it everything the App is installed on, at the App's own permissions. So where you install the App, and with what permissions, is the outer wall.
The broker Every agent's sandboxes, and the say over which sandbox holds which grant. The gateway still holds each grant to the menu's ceilings. So put nothing on the menu that the host's own services could not be trusted to hand out.
The runner The host. It is root.

What is written down, and what never is

The private audits

The broker and the gateway each keep an audit in a database of their own, readable by root and that service's user. Rows are kept 30 days by default.

The broker's holds what agents asked: creates, each command's arguments and how it ended, files moved, profile and grant changes, and each session's usage. The gateway's holds each capability call: who, which capability, the method and path, granted or refused and why, the status and the sizes.

The logs

A sandbox's content does not go to the host's shared logs. Not a command's arguments, not a path, not a hostname it asked for, not a byte of output. Logs carry counts and closed words.

Neither audit holds a command's output, a file's contents, or a capability call's query, headers or body. The broker has no model in it and reads no output except to stream it to the caller that asked.

How it was tested

From a real guest

A proof script, scripts/kvm_proof.sh in the repository, boots real guests under Firecracker and drives everything through the real path: clone, fetch, push, refusals, revocation mid-stream, a gateway restart under a running guest. At its last recorded run, every one of the script's own checks passed; docs/cap.md records the count. The project has had no outside security review.

The push reader, against Git

The code that reads a push before it leaves the host is checked against real request bodies from Git, and every single-byte change of a valid push is compared with what a real git receive-pack makes of it.

Refusals cost nothing upstream

Tests assert that every push the policy forbids costs the code host no connection and no token, and that no token, key or secret appears in any response, audit row, metric or log line.

Reviewed, more than once

The capability work was reviewed adversarially before it merged and again after. What was done about the findings is in the dated amendments of the design records under docs/proposals; the reviews themselves are not published here.

Decisions are on record

Why it is built this way is written down as proposals and decision records in docs/, kept as they were on their day.

Not shown by a test

Anything against GitHub itself. Every upstream in a test is a stand-in, and nothing in CI talks to GitHub. It was run by hand once, on 4 December 2026, for one private scratch repository. That GitHub holds a token to its one repository is still its documented behaviour: the gateway refuses a call outside a grant before any token is used, so no run tries it.

Known gaps

These are the places where the walls are not. The complete lists are in docs/cap.md and docs/runner.md.

By design

  • Everything in a sandbox can spend its grants. The gateway tells sandboxes apart, not processes. Separate trust means separate sandboxes.
  • An allowed hostname, and any capability that carries free text, is a way out for data. A list and a limit bound it and record it. They do not close it.
  • The gateway is one place for every upstream credential. That is the price of no credential being anywhere else.

Capabilities

  • A push is code execution wherever CI runs on it. A push is judged by the refs it names, never by what the commits hold. No token can change a workflow's definition, but a workflow runs the repository's own files.
  • An API route's body is not read. A route is every operation its upstream serves at that method and path. One that posts a review can approve.
  • Whether a branch is new is the caller's claim. The gateway cannot see the remote ref; the code host checks the claim and refuses a false one.
  • What a token can really do is the code host's word. The gateway asks narrowly and refuses an answer that grants more than it asked. It cannot test the token.
  • The day's quota is the agent's, shared by its sandboxes. One of them can spend it for the others. The per-minute and in-flight counts start again when the gateway restarts.

Operations

  • No bandwidth limit. Bytes through the proxy are counted, not throttled.
  • One host. The runner is root on it, and a failure of the host is a failure of every sandbox on it.
  • Run against GitHub itself once, by hand, as above. No test repeats it.
Found something? How to report it is in SECURITY.md in the repository. Where a page of this site and a specification disagree, the specification is right and the difference is a finding.