2026-01-26 19:54:21 -08:00
---
2026-01-26 20:50:11 -08:00
title: Formal Verification (Security Models)
2026-01-30 03:15:10 +01:00
summary: Machine-checked security models for OpenClaw’ s highest-risk paths.
2026-01-26 20:32:12 -08:00
permalink: /security/formal-verification/
2026-01-26 19:54:21 -08:00
---
2026-01-26 20:50:11 -08:00
# Formal Verification (Security Models)
2026-01-30 03:15:10 +01:00
This page tracks OpenClaw’ s **formal security models** (TLA+/TLC today; more as needed).
2026-01-26 20:50:11 -08:00
2026-01-27 15:19:34 -08:00
> Note: some older links may refer to the previous project name.
2026-01-27 15:12:26 -08:00
2026-01-30 03:15:10 +01:00
**Goal (north star):** provide a machine-checked argument that OpenClaw enforces its
2026-01-26 20:50:11 -08:00
intended security policy (authorization, session isolation, tool gating, and
misconfiguration safety), under explicit assumptions.
**What this is (today):** an executable, attacker-driven **security regression suite** :
2026-01-31 21:13:13 +09:00
2026-01-26 20:50:11 -08:00
- Each claim has a runnable model-check over a finite state space.
- Many claims have a paired **negative model** that produces a counterexample trace for a realistic bug class.
2026-01-30 03:15:10 +01:00
**What this is not (yet):** a proof that “OpenClaw is secure in all respects” or that the full TypeScript implementation is correct.
2026-01-26 20:50:11 -08:00
## Where the models live
2026-01-30 03:15:10 +01:00
Models are maintained in a separate repo: [vignesh07/openclaw-formal-models ](https://github.com/vignesh07/openclaw-formal-models ).
2026-01-26 20:50:11 -08:00
## Important caveats
- These are **models** , not the full TypeScript implementation. Drift between model and code is possible.
- Results are bounded by the state space explored by TLC; “green” does not imply security beyond the modeled assumptions and bounds.
- Some claims rely on explicit environmental assumptions (e.g., correct deployment, correct configuration inputs).
## Reproducing results
Today, results are reproduced by cloning the models repo locally and running TLC (see below). A future iteration could offer:
2026-01-31 21:13:13 +09:00
2026-01-26 20:50:11 -08:00
- CI-run models with public artifacts (counterexample traces, run logs)
- a hosted “run this model” workflow for small, bounded checks
Getting started:
```bash
2026-01-30 03:15:10 +01:00
git clone https://github.com/vignesh07/openclaw-formal-models
cd openclaw-formal-models
2026-01-26 20:50:11 -08:00
# Java 11+ required (TLC runs on the JVM).
# The repo vendors a pinned `tla2tools.jar` (TLA+ tools) and provides `bin/tlc` + Make targets.
make < target >
```
### Gateway exposure and open gateway misconfiguration
**Claim:** binding beyond loopback without auth can make remote compromise possible / increases exposure; token/password blocks unauth attackers (per the model assumptions).
- Green runs:
- `make gateway-exposure-v2`
- `make gateway-exposure-v2-protected`
- Red (expected):
- `make gateway-exposure-v2-negative`
See also: `docs/gateway-exposure-matrix.md` in the models repo.
### Nodes.run pipeline (highest-risk capability)
**Claim:** `nodes.run` requires (a) node command allowlist plus declared commands and (b) live approval when configured; approvals are tokenized to prevent replay (in the model).
- Green runs:
- `make nodes-pipeline`
- `make approvals-token`
- Red (expected):
- `make nodes-pipeline-negative`
- `make approvals-token-negative`
### Pairing store (DM gating)
**Claim:** pairing requests respect TTL and pending-request caps.
- Green runs:
- `make pairing`
- `make pairing-cap`
- Red (expected):
- `make pairing-negative`
- `make pairing-cap-negative`
### Ingress gating (mentions + control-command bypass)
**Claim:** in group contexts requiring mention, an unauthorized “control command” cannot bypass mention gating.
- Green:
- `make ingress-gating`
- Red (expected):
- `make ingress-gating-negative`
### Routing/session-key isolation
**Claim:** DMs from distinct peers do not collapse into the same session unless explicitly linked/configured.
- Green:
- `make routing-isolation`
- Red (expected):
- `make routing-isolation-negative`
2026-01-27 15:32:30 -08:00
## v1++: additional bounded models (concurrency, retries, trace correctness)
These are follow-on models that tighten fidelity around real-world failure modes (non-atomic updates, retries, and message fan-out).
2026-01-27 15:35:24 -08:00
### Pairing store concurrency / idempotency
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
**Claim:** a pairing store should enforce `MaxPending` and idempotency even under interleavings (i.e., “check-then-write” must be atomic / locked; refresh shouldn’ t create duplicates).
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
What it means:
2026-01-31 21:13:13 +09:00
2026-01-27 15:35:24 -08:00
- Under concurrent requests, you can’ t exceed `MaxPending` for a channel.
- Repeated requests/refreshes for the same `(channel, sender)` should not create duplicate live pending rows.
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
- Green runs:
- `make pairing-race` (atomic/locked cap check)
- `make pairing-idempotency`
2026-01-27 15:32:30 -08:00
- `make pairing-refresh`
- `make pairing-refresh-race`
2026-01-27 15:35:24 -08:00
- Red (expected):
- `make pairing-race-negative` (non-atomic begin/commit cap race)
- `make pairing-idempotency-negative`
- `make pairing-refresh-negative`
2026-01-27 15:32:30 -08:00
- `make pairing-refresh-race-negative`
2026-01-27 15:35:24 -08:00
### Ingress trace correlation / idempotency
**Claim:** ingestion should preserve trace correlation across fan-out and be idempotent under provider retries.
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
What it means:
2026-01-31 21:13:13 +09:00
2026-01-27 15:35:24 -08:00
- When one external event becomes multiple internal messages, every part keeps the same trace/event identity.
- Retries do not result in double-processing.
- If provider event IDs are missing, dedupe falls back to a safe key (e.g., trace ID) to avoid dropping distinct events.
- Green:
2026-01-27 15:32:30 -08:00
- `make ingress-trace`
- `make ingress-trace2`
- `make ingress-idempotency`
- `make ingress-dedupe-fallback`
2026-01-27 15:35:24 -08:00
- Red (expected):
- `make ingress-trace-negative`
- `make ingress-trace2-negative`
- `make ingress-idempotency-negative`
2026-01-27 15:32:30 -08:00
- `make ingress-dedupe-fallback-negative`
2026-01-27 15:35:24 -08:00
### Routing dmScope precedence + identityLinks
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
**Claim:** routing must keep DM sessions isolated by default, and only collapse sessions when explicitly configured (channel precedence + identity links).
What it means:
2026-01-31 21:13:13 +09:00
2026-01-27 15:35:24 -08:00
- Channel-specific dmScope overrides must win over global defaults.
- identityLinks should collapse only within explicit linked groups, not across unrelated peers.
2026-01-27 15:32:30 -08:00
2026-01-27 15:35:24 -08:00
- Green:
- `make routing-precedence`
2026-01-27 15:32:30 -08:00
- `make routing-identitylinks`
2026-01-27 15:35:24 -08:00
- Red (expected):
- `make routing-precedence-negative`
2026-01-27 15:32:30 -08:00
- `make routing-identitylinks-negative`