# Sandboxes and security

> Where Werker agent code runs, what it can reach, where your keys are kept, how workspaces are separated, and what has not been done.

Source: https://werker.cloud/security (updated 2026-12-01)

Agent code runs in a sandbox created for that run and deleted after
it, never in the worker process. Provider keys are sealed so the web
app cannot read them, and each workspace's rows are separated by
Postgres row-level security. Werker's own instance is live over HTTPS.
Parts of the sandbox options have not been run, as listed below.

## One sandbox per run

A run is one execution of an agent, workflow or factory request. Each
run gets its own sandbox, created on its first command and deleted
when the run finishes. Code that agents write is treated as untrusted.

The worker, a separate process, keeps what must be trusted: the queue
claim, durable run state, model calls with the workspace's keys, and
writing run events. It sends code and tool calls into the sandbox.
Sandboxes are never shared between workspaces. Only the worker
controls Docker, never the agent containers.

## Sandbox providers

You choose the provider in Admin → Sandboxes. Only an instance
administrator can.

|                       | Docker with gVisor                                                                                                                                  | Daytona                                                                     | Docker Cloud Sandboxes                                                 |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| Runs on               | Your own host                                                                                                                                       | Daytona's service                                                           | Docker's service                                                       |
| Isolation             | gVisor user-space kernel                                                                                                                            | Provider's                                                                  | Provider's                                                             |
| Key references        | Yes, through the gateway                                                                                                                            | No                                                                          | No                                                                     |
| Git                   | Yes, through the gateway                                                                                                                            | With a GitHub App connection; checked by script on 2026-11-28               | With a GitHub App connection; checked by script on 2026-11-28          |
| Allowed-sites network | Yes, tested                                                                                                                                         | Built, not run                                                              | Built, not run; needs the Docker account to deny by default first      |
| CPU and memory limits | Yes                                                                                                                                                 | Rounded up to whole CPUs and GiB; not run                                   | Five fixed sizes; not run through a worker                             |
| Process limit         | Yes                                                                                                                                                 | Not applied                                                                 | Not applied                                                            |
| What has been run     | Tested on a cloud VM: start and stop, memory and CPU caps, no host files visible, network blocked or allowed, a run killed mid-cleanup then resumed | One generation evaluation (8 cases needing a shell, 6 passed), network none | The adapter driven by a script, network none; not run through a worker |

Not run on Daytona: the allowed-sites network, CPU and memory limits,
and stopping and restarting the sandbox of a run waiting for input.
Docker describes Cloud Sandboxes as experimental. It ends a sandbox
session 24 hours after it starts, and a command still running then is
untested.

## Network access

Sandbox network access is one of three settings, per instance:

- `none`: no network. This is the default. On Docker it is
  `--network none`.
- `gateway`: only the sites you allow. On Docker, sandboxes join an
  internal network whose only reachable peer is a forward-proxy
  gateway that allows listed hosts, and `.example.com` allows
  subdomains. On Daytona it maps to Daytona's domain allow-list. On
  Docker Cloud it needs the account's policy set to deny by default,
  because with a new account a sandbox allowing only one site still
  reached other sites.
- `open`: refused for a Docker host, because an open container could
  reach that host's network. Hosted providers allow every site by
  default, so Admin picks `open` when one is chosen. This has not been
  run against either provider.

On Daytona tiers 1 and 2, the organisation's own restrictions apply
and a sandbox's setting cannot override them. Gateway requests are not
yet recorded in the audit log.

## Limits and concurrency

Admin → Sandboxes sets CPUs, memory and processes per sandbox (off
unless set) and the most sandboxes at once on the host (none by
default). A worker runs one run at a time by default, and an operator
can cap running runs per workspace.

## Sandbox images

A sandbox starts from one image, which decides what is installed.
Admin → Sandboxes lists the images; one is the default
(`node:22-alpine`). A worker probes each image in a no-network sandbox
to record what it contains. Planning picks the image for the work from
that list, and the agent is told what the image has. If planning picks
none, the default is used. Image selection has been run on Docker
Cloud Sandboxes and Daytona, not on Docker with gVisor. You cannot yet
choose an image by hand, use private images or build one.

## Where your keys are

- Provider keys are sealed in the web app with a public key. The web
  app can store a key but cannot read it back. Only the worker, which
  holds the install's master key, opens it.
- A key never enters a sandbox. On Docker with gVisor, a sandbox gets
  a reference and a run token. The gateway outside the sandbox swaps
  the reference for the key on the outgoing call, only for that run's
  workspace. The grant is held in the gateway's memory and removed
  with the sandbox.
- A sandbox provider's own key (Daytona, Docker) is sealed the same
  way, and one provider's key is never sent to another.
- Daytona and Docker Cloud sandboxes cannot reach the gateway, so they
  get no provider keys and no Git, and work that needs them waits.

## Workspaces, roles and sign-in

A workspace is private: a company with several users, or one person.
It owns its connections, agents, workflows, runs and audit log. A
self-hosted install usually has one workspace. A user belongs to one.

- Roles are owner, admin, member and viewer, held per membership. An
  admin can switch permissions on or off per role. A denied request
  returns 404, so it does not reveal that the thing exists.
- Row-level security: workspace-owned Postgres tables carry a
  workspace ID and a policy, and the app connects as a role that does
  not own the tables. A query that forgets its workspace filter still
  cannot read another workspace's rows.
- Sign-in uses Better Auth with email and password. Public sign-up is
  off.
- The first user is the instance administrator, who sees settings the
  whole instance shares, such as sandboxes.

## Audit log and visitor analytics

The audit log is append-only: the app's database role can add and read
events but not change or delete them. It records changes to members,
roles and connections, sign-ins, runs, sandbox lifecycle, shell
commands (first 500 characters), and service calls, never keys or
request bodies. It is per workspace and shown in Admin → Audit. It
does not yet record factory conversations or the role used on each
event.

Visitor analytics stores page views without an IP address, raw user
agent or cookie. A daily visitor hash uses a salt that is replaced
every UTC day, so a visitor cannot be linked across days. Only
instance administrators see it.

## What has not been done

- The install script's `--domain` option has not issued a real
  certificate. Werker's own instance is live over HTTPS on Coolify.
- No external audit or penetration test has been done. Nothing in the
  project records one.
- Everything listed above as not run: Daytona's allowed-sites network,
  limits and stop and restart; Docker Cloud Sandboxes through a
  worker, its allowed-sites network, and a command crossing 24 hours;
  `open` on either hosted provider; image selection on Docker with
  gVisor.
- Row-level security, the worker and sandboxes were tested by hand,
  not by automated tests.
- Per-workspace allowlists, and workspaces bringing their own sandbox
  host, are not built. Live previews of agent dev servers are planned.
