# Security

> [!CAUTION]
> The board runs agents with shell access. They execute commands, approve tool
> permissions and merge git branches on the machine rev0 runs on. Anyone who can reach an
> unauthenticated board can do the same through it. **An open port is remote code
> execution.** Set `REV0_AUTH_TOKEN` before exposing the board to any network.

## Why the port is the boundary

The permission gate ([The permission gate](permission-gate.md)) decides what an *agent*
may do. It does not decide who may drive the board. Whoever reaches the board's API can
create a ticket that asks for anything, approve every permission request, and turn the
permission gate's lists off in Settings. So the question that matters first is who can reach the
port.

## What rev0 does about it

- **Loopback by default.** `rev0 serve` binds to `127.0.0.1`, so out of the box only this
  machine can reach it, and no token is needed.
- **Refuses an open bind.** Binding to any other address with no `REV0_AUTH_TOKEN` set is
  refused at startup. `REV0_ALLOW_INSECURE=1` overrides that and logs a loud warning on
  every start; do not use it on a network you do not fully control.
- **Two credentials.** `REV0_AUTH_TOKEN` is yours: a browser signs in with it once at
  `/login` and keeps a cookie, and your own CLI sends it as `Authorization: Bearer`. The
  desktop app generates one for you. Agents never hold it. The board derives a second
  credential from it, hands that one to everything it starts (the runner, the tool
  servers, the browser tools, an agent's shell, as `REV0_AGENT_TOKEN`), and takes your
  token out of its own environment once it serves. The agents' credential signs nobody
  in: `/login` refuses it and the cookie cannot be computed from it.
- **The board knows who is calling.** What arrives with the agents' credential is recorded
  as an agent's. An agent cannot say "the human did this", and a request that leaves the
  author out is recorded as its caller.
- **The agents' API is a list.** With its credential an agent can read the board, and
  write only to the routes its own tools call. Every other route answers 403 to it,
  including any route added later.
- **Human-only actions.** Some actions only a signed in browser session may take, never a
  credential in a header, so neither an agent nor a script can reach them:
  - answering a tool request (allowing or denying it);
  - reading the access token in Settings;
  - minting, listing and revoking public share links, and stopping all public sharing at once;
  - changing which plugin sources load, which commit they are pinned to and which plugins
    you trust, and fetching a plugin source;
  - adding, editing, reordering and deleting apps in the App Space;
  - installing a browser extension on the ticket's browser, and changing its session mode;
  - writing to the Knowledge Base directly (agents propose pages into a review queue
    instead);
  - testing an MCP server and reading the MCP and skills inventories.

  The terminal, the voice and the browser panel sockets are yours too. The agents'
  credential opens one socket: the one its browser tools use to drive the ticket's
  browser.
- **A page an agent wrote never runs as you.** An HTML or SVG artifact, a plan page and
  the draft of a paused run are served from the board's own address. Every response that
  can run script and is not one of the board's own pages carries a sandbox policy, so the
  page gets an origin of its own wherever it is opened: inside the ticket, or alone in a
  tab. Its script has no session of yours, cannot read the access token and reaches no
  human-only action. A route added later is sealed the same way.
- **Keep the token in `~/.rev0/.env`.** A token exported in the shell that starts the
  board, or passed as `--auth-token`, can be read by every program of your user in the
  process list. The board says so once at start. From `.env` it is read by the board
  alone, and a restart reads it from there again.
- **The agent's environment can be narrowed.** By default an agent's processes inherit the
  rest of the board's environment. **Allow-list the agent's environment** builds their
  environment from an allow-list instead; see
  [What an approved command can read](permission-gate.md#what-an-approved-command-can-read).

## What this does not protect

- **A board with no token keeps no boundary.** On a loopback board with no
  `REV0_AUTH_TOKEN` there is no credential to tell callers apart: every route, the
  human-only ones included, is open to anything on this machine, and nothing is recorded
  as an agent's unless the caller says so. Set a token to get the rules above.
- **Agents run as your own user.** A program an agent writes can read `~/.rev0/.env`.
  The permission gate refuses a command or a file tool that names that file, which stops
  the plain read and not a hidden one. Closing it needs a sandbox for the agents' shells.
- **The API does not check what you approved.** What a tool may do without asking is
  checked beside the agent, by the permission gate, and not by the API. With its own
  credential an agent can still write directly to a route on its list (merge, delete, a
  top level ticket) and skip that check. The permission gate blocks the plain `curl`. Closing it
  needs the API to check the approval itself.

## Exposing the board safely

1. Generate a token and set it: `REV0_AUTH_TOKEN=...` in `~/.rev0/.env`, or
   `--auth-token`.
2. Prefer a private network (a Tailscale tailnet) over a public one, and HTTPS over plain
   HTTP. [Reach the board from your phone](../how-to/phone.md) covers each option.
3. On a public tunnel, add an identity layer in front of the token when you can.
4. To show someone a result, share one artifact, ticket or board with a capability link
   rather than the token ([Share a deliverable publicly](../how-to/share.md)).

## Plugins that run code

Trusting a plugin's hooks or tools lets its Python run inside the runner with the board's
full access. Read the code you trust; see [Plugin trust](plugin-trust.md).

## Reporting a vulnerability

Report it privately to whoever gave you your copy of rev0, with what you did, what happened and
the version you run. Do not post it anywhere public.
