# CAIN-42 × TALOS: Enforcement Coverage & Operating System Controls
## Evolution 5 — Operation Double Sovereign

---

### 1. Execution Boundary Matrix

| Execution Path | Implementation Component | Enforcement Technology | Protection Status | Evidence / Verification |
|:---|:---|:---|:---:|:---|
| **Governed Command Runner** | `cain/talos/talos_adapter.py:TalosGovernedCommandRunner` | Landlock ABI 8 + `PR_SET_NO_NEW_PRIVS` + RLIMITs | **PROTECTED** | 38 adversarial tests in `test_cain_talos_governance.py` |
| **Governed Filesystem** | `cain/talos/talos_adapter.py:TalosGovernedFilesystem` | Python Path Boundary + Landlock FS | **PROTECTED** | Path violation tests assert `PermissionError` on path escapes |
| **talos-coder Daemon Tool** | `talos-coder/daemon/tools/run_command.py` | Wrapped via `TalosGovernedCommandRunner` | **REMEDIATED (LOCAL)** | Direct invocation without envelope yields exit code 126 |
| **Mediated Subprocess Launcher** | `cain/cain_mediated_launcher.py` | Landlock ABI 8 + seccomp + RLIMITs | **PROTECTED** | 9 passed in `test_evolution_3_mediated_launcher.py` |
| **Gateway Hosted In-Process Tools** | `platform-gateway/main.py` | In-process Python functions | **UNCONFINED** | **CRITICAL LIMITATION:** Runs in-process without Landlock |
| **External Agent SDK / Direct Shell** | Raw bash / external python scripts | None | **UNGOVERNED** | Outside CAIN / TALOS mediation boundary |

---

### 2. Operating System Kernel Controls Exercised

1. **Linux Landlock LSM (ABI 8):**
   - Active on host kernel: `Linux 7.0.0-38-generic x86_64`.
   - Filesystem Rules:
     * `read_exec`: `/usr`, `/lib`, `/lib64`, `/bin`, `/sbin`, Python prefix.
     * `read_only`: `/etc/ld.so.cache`, permitted read directories in envelope.
     * `read_write`: Permitted write directories in envelope.
     * Denied by default: All other paths (including `/etc/shadow`, `/root/.ssh`, host configurations).
   - Network Rules (ABI $\ge 4$):
     * `tcp_connect_ports = ()`: Blocks all outgoing TCP connections at the kernel layer, raising `Errno 13 Permission denied`.
2. **Process Privileges (`prctl`):**
   - `PR_SET_NO_NEW_PRIVS = 1`: Prevents child processes from gaining privileges via setuid/setgid binaries or filesystem capabilities.
3. **Resource Limits (`setrlimit`):**
   - `RLIMIT_AS`: Clamps virtual address space to envelope `max_memory_bytes` (default 256 MB).
   - `RLIMIT_CORE = 0`: Disables core dumps to prevent secret leakage in process memory dumps.
   - `close_fds = True`: Prevents inheritance of open host file descriptors.

---

### 3. Physical AI & High-Impact Safeguards

1. **Emergency Stop (E-Stop):**
   - `TalosSafetyInterlock` implements a thread-safe latch. When triggered, any consequential operation raises `EmergencyStopActive` and immediately halts execution.
   - Reset requires an authenticated operator token.
2. **Parameter Clamping:**
   - Numerical actuators (velocity, voltage, power, budget) are clamped within bounded operating envelopes $[V_{\min}, V_{\max}]$.
3. **Sensor Observation Freshness:**
   - Sensor observations older than authorized TTL (default 2.0s) are rejected with `STALE_SENSOR`.

---

### 4. Remaining Execution Bypasses & Scope Boundaries

> [!WARNING]
> While `TalosGovernedCommandRunner` and `cain_mediated_launcher.py` establish real Landlock LSM sandboxing on disposable worker processes, **hosted tools in `platform-gateway/main.py` continue to execute in-process**. Until production gateway traffic is routed through out-of-process workers or MCPGate containers, the production release gate remains strictly **BLOCKED**.
