# verbgate threat model

## Assets

- Host credentials, SSH keys, and the operator's account.
- The host-only approval record, frozen snapshots, mutation ledger, and logs.
- The launcher/runner binary and the policy that defines the allowed verbs.
- Live edge, certificate, DNS, VPS, and database state reachable by a verb.

## Adversaries

1. **Compromised container.** Can write the control directory, propose trees,
   author `policy.json`, send arbitrary jobs, and request trust updates. Cannot
   approve; a proposal is reviewed and selected by the operator.
2. **Malicious job author.** Can choose any verb name and arguments. Must stay
   inside the approved typed envelope.
3. **Tampered approved artifacts.** Can modify files after approval. Detected by
   canonical hashes and frozen-copy verification.
4. **Accidental operator error.** Approves a widened verb or a changed policy.
   Mitigated by hashes, diffs, and a single review at approval time.

## Trust boundary

| Zone | Writer | Contents |
| --- | --- | --- |
| Shared | Container | control dir, `policy.json`, jobs, proposals |
| Host-only | Operator | launcher, approval, frozen snapshots, ledger, results, logs |

The host-only anchors must be absolute, owner-only (or root), non-symlinked,
and outside the container-writable control directory. The policy cannot
redirect an anchor the host already set.

## Controls

- Typed jobs; unknown protocols, verbs, arguments, and provenance hashes are
  rejected before execution.
- Canonical hashes over the policy and runner; any change requires a new
  approval.
- Argument grammar (`enum:`, `regex:`, `hostname`, `ipv4`, `ipv6`, `hex64`,
  `int:`, `enum-set:`, `path`, `bool`) enforced before the runner starts.
- At-most-once ledger for mutating verbs; denied and dry-run jobs are not
  recorded.
- Clean environment, per-job temp dir, wall-clock timeout, process-group kill,
  output caps, `no-new-privileges`, and optional credential drop.
- `sudo` defaults to a password prompt; the executor never invokes
  `sudo` itself.

## Proposal controls

- The container writes a proposal and staged payloads under the control dir; it
  never writes the host env, approval, store, or ledger.
- The host strict-parses and bounds the proposal, re-validates every env key
  against the approved policy allowlist, and re-reads the env file itself.
- The operator selects which changes to apply; the selected subset is applied
  atomically and the approval records the new env hash. A denied or invalid
  proposal leaves the env and approval untouched.
- Proposal decisions are replay-recorded in the host-only ledger; a replayed id
  returns the recorded result instead of applying twice.
- Policy/runner and launcher changes are separate
  reviewed paths; they cannot be applied by the env channel.
- Policy/runner payloads are copied to host-only temp before hashing or
  executing; the control dir is never trusted after the copy. Caps are 64 KiB
  for policy and 64 MiB for runner; symlinks, `..`, absolute paths, non-regular
  files, and oversize inputs are rejected.
- The proposed runner is executed only for `--catalog` and `--check-policy`,
  with a minimal env, fresh temp cwd, timeout, output cap, process-group kill,
  and rlimits applied by the host-owned `sandbox-exec` wrapper. Launcher provenance comes from an authoritative origin build.
- The host validates the resulting policy+runner pair (catalog,
  `--check-policy`, trust guards, env allowlist) before freezing it, and
  rejects an unreviewed env-file change.
- The host builds a launcher only from an origin commit recorded by a successful
  `repo.push` in the host-only `.repo-push` ledger. The host fetches into a
  fresh host-only checkout, verifies `HEAD` and a clean tree, requires the
  checkout's build-script hash to match the proposal, and builds under the
  sandbox wrapper with a bounded timeout and output cap. The candidate runs its
  own `review`/`verify` before install; the operator types the first 12 hex
  chars of the new hash; the old launcher is kept as `hostexec.<sha>`. A
  launcher change cannot be mixed with another change type, and the
  container never supplies an install path, origin, or build directory.

## V3 controls and non-goals

- The policy path executes only frozen `policy/runner` copies under the
  host-only root; the source policy and repo runner are not executed live.
- The ledger, approval, policy, and runner are host-only. The control directory
  is the only container-writable path.
- Runner rlimits: `RLIMIT_CPU`, `RLIMIT_NOFILE`, `RLIMIT_FSIZE`, and
  `RLIMIT_CORE=0`. `RLIMIT_AS` is deliberately not set.
- Sudo modes are `none`, `marker`, and `password`; M11 uses `none`.
- Network egress is **review-only** in V3. `grants.network` is a declaration,
  not an OS firewall; a dedicated executor user plus nftables/cgroup
  confinement is deferred to FH-2d.