# Sovereign Evolution 3 of 42 — specification

Highest-priority unresolved risk from Evolution 2: **nothing below the application blocks a tool server's own exec,
file or network operations** (T-E2-01, T-S17-05; Z3 property `tool_server_performs_unauthorized_exec_file_or_network_op`
is SAT). Evolution 3 starts there.

## Owner decisions needed first

1. **Deploy eaf8d4fa** (operator allowlist precedence) with `rolling_deploy.py`, then verify both instances. Until
   this happens, the live gateway runs the 3eff02c2 behavior on this path.
2. **CI service.** The repository has no git remote, so no CI has ever run. Either add a remote with Actions
   enabled, or approve a local runner (cron or systemd timer) that executes
   `scripts/ci/run_authorization_suite.py --json` and publishes the JSON.
3. **Kit 8.3.0** contains `formal/authorization_model.py` in error. Decide whether to withdraw it and cut 8.3.1.
4. **Kernel enforcement scope.** Approve Landlock for (a) stdio tool servers and (b) gateway sandbox routes, and
   say which paths and ports each tool-server profile may use by default.

## Work items

| # | Item | Acceptance (must fail on bf5a0038, pass after) |
|---|---|---|
| E3-1 | **Landlock for stdio tool servers.** The host has Landlock ABI 8. Add a per-server profile (read/write paths, exec paths, TCP ports) to `StdioMCPProxy`, applied in `preexec_fn` after the seccomp filter. Refuse to start if the ruleset can't be enforced, mirroring the seccomp rule. | Extend `test_sovereign_e2_stdio_seccomp_reality.py`: file write outside the profile → EACCES, exec of a non-allowlisted binary → EACCES, TCP connect to a non-allowlisted port → EACCES; allowed operations still work. |
| E3-2 | **Hosted tool bodies.** Hosted tools run inside the gateway process, where a process-wide Landlock would also restrict the gateway. Move side-effecting hosted tools into a Landlock-restricted worker subprocess, or record a scoped owner decision that keeps T-S17-05 open. | Hosted tool attempting a write outside its profile → refused by the kernel; a test proves it. |
| E3-3 | Shared, durable single-use store across blue/green for capability and proof nonces (T-S46-06). | Two-process test: same token to both → exactly one execution; a failed store write → DENY. |
| E3-4 | Bind hosted-pipeline agent/tenant to the authenticated API-key principal (T-S46-05). | Proof for agent A on agent B's key → DENY even with `_cain_agent=A`. |
| E3-5 | SDK guard: require a signed gateway decision (T-S17-04, session -17). | Unsigned or forged ALLOW from a fake gateway → DENY; the cache never stores it. |
| E3-6 | Durable, request-bound MCPGate decision ledger (T-S17-06): request → decision → JIT consumption → downstream outcome, hash-chained, fail-closed append. | Tamper tests (delete, reorder, duplicate) detected; conflicting terminal outcome refused. |
| E3-7 | Remove the optional signer pins (T-S46-09) and the caller-supplied pin in `ChainCapabilityStage` (T-E2-02, owner -82). | Unpinned call → refusal in each verifier. |
| E3-8 | Model–code linkage: drive the Z3 model and the side-effect tests from one table of decision predicates. | A mutated predicate that isn't mirrored fails CI. |

## Not in scope

Hardware attestation, third-party audit, and any change that needs root on customer hosts.
