# Security model

> What the approval gate guarantees, and what it does not. Read before serving the API.

The approval gate is an **execution guarantee**, not access control. Know which one you have before
you serve the API.

## What the gate guarantees

- **The model cannot approve.** Its output is only a proposal. A `human` capability is parked, and
  only `POST /proposals/{id}/approve` releases it.
- **Approval releases exactly what was parked.** The request carries nothing but the caller's token;
  the method and params come from the ledger. Validation and the gate re-run first, and a second
  approval is refused.
- **Every release is recorded** with the caller who made it.
- **The model never chooses where a handler writes.** A capability with `workspace: true` gets a folder
  Loom made.
- **A wrong param is never executed.** It goes back to the model with the errors.

## What it does not guarantee

- **A token is a key.** Every route but `GET /health` and `/viewer` needs a bearer token, issued with
  `python -m loom.api.tokens issue`. Anyone holding one can read, approve, reject, start cycles and
  add observations, within the gate.
- **Loom cannot tell a person from a script.** The approver is whoever holds the token. The ledger
  names that caller; nothing checks a human pressed the button.
- **A workspace is not a sandbox.** A handler is your code and can open any path its process can.

## Operate accordingly

- **Stay on loopback.** `python -m loom.api` binds `127.0.0.1` by default. Binding `0.0.0.0` hands
  approval to every host that can reach the port, over plain HTTP.
- **Name your hosts.** Requests are refused unless their `Host` header is loopback, the bound host, or
  one passed with `--allow-host`. To serve a LAN client:
  `--host 0.0.0.0 --allow-host 192.168.1.20`.
- **Serve only while you need it**, on a machine whose processes you trust.
- **Keep secrets out of bundles.** Credentials are `vault://` references, never inline, and Loom
  touches only what it created.