# Security model

**Spinbox is experimental: APIs change and data may be lost.** What is built and what proves it is on [Status](https://docs.spinbox.dev/reference/status.md); what Spinbox does not do is on [Limitations](https://docs.spinbox.dev/overview/limitations.md).

> What Spinbox protects, from whom, and how: isolation, network, data, identity and supply chain, and where to read about each.

Spinbox runs code its operators do not fully trust, on machines in their own account. Its security
model starts from that: **a workspace's tenant is root inside it, and may be hostile.** Everything
else is built to keep root in a workspace from reaching anything outside it. The pages below
describe how, mechanism by mechanism; none of them is a guarantee.

## What it protects

| Asset | From |
|---|---|
| Other workspaces, and the runner | Code inside a workspace, including root and the kernel |
| The installation's network and the cloud account | A workspace's traffic |
| Workspaces' disks and memory | Anyone who reads the bucket, or a runner's disk |
| The installation's secrets | Anyone who reads the database alone |
| Each user's workspaces, snapshots and ports | Other users of the installation |
| What a machine runs | Anyone who changes an image, a package or a release after it was built |

## The layers

- **[Isolation](https://docs.spinbox.dev/security/isolation.md).** Every workspace is a virtual machine with its own kernel.
  Its QEMU runs as its own user, in an empty network namespace and a bounded cgroup, and reaches
  nothing on the host but what it is handed.
- **Network.** A workspace reaches nothing until a policy allows it, a DNS question for a name the
  policy does not name included. Its traffic to the runner's own networks and the cloud's metadata
  service is dropped before any policy is read, and nothing dials into it: what comes in is a
  session through the proxy, opened from the runner's side.
  See [Network and egress](https://docs.spinbox.dev/concepts/network.md) and [Network on AWS](https://docs.spinbox.dev/aws/network.md).
- **[Data and encryption](https://docs.spinbox.dev/security/data.md).** Every layer of every disk is encrypted with its
  volume's key before it leaves the runner. Keys are wrapped under a key the database does not
  hold. Memory snapshots have keys of their own, destroyed with them.
- **[Identity and access](https://docs.spinbox.dev/security/identity.md).** Every request is authorized against the
  resource it names, at the time it is made. "Not yours" is answered as "not found".
- **[Supply chain](https://docs.spinbox.dev/security/supply-chain.md).** Every release is signed and checked before it is
  unpacked. Every machine boots a read-only root the kernel verifies block by block.

## Rules with gates

Spinbox keeps its security rules in a table in its repository, `docs/security/README.md`. Each rule
names the code that keeps it and the test that fails the build when it is broken, and a rule no
test keeps says so. The site prints that table, [Rules and their gates](https://docs.spinbox.dev/reference/security/rules.md),
and the README's open items, [Known gaps](https://docs.spinbox.dev/reference/security/known-gaps.md), from spin itself.

Those rules hold against a workspace, a stolen session or a copied credential. Against the control
plane itself running someone else's code they mostly do not: it holds every key and decides who
logs in, and the README says so in
[What this does not protect](https://docs.spinbox.dev/reference/security/known-gaps.md#what-this-does-not-protect). No
way of doing that is known, and no outside test has looked for one yet.

To report a problem, see [Reporting a vulnerability](https://docs.spinbox.dev/security/reporting.md).
