Formal Verification (TLA+ / TLC)
6 exhaustive TLA+ formal specifications verified with TLC 2.19 across 1.93M states (Four-Eyes, Zero Auto-Enforce, PQ Fleet, Reverse RPC, Audit Chain).
Interactive Isometric Architecture Simulators
Post-Quantum Zero-Trust Onboarding & Outbound Reverse Live RPC
See how 1 to 10,000+ Linux servers join a hub with zero inbound ports and instant revocation.
Admin mints scoped enrollment token (stored as SHA3-256)
From /nodes -> Add node, an admin mints a single-use or unlimited (max_uses=0) cluster token. Only its SHA3-256 digest is persisted in SQLite migration 0027.
{
"metadata": { "cluster": "prod-eu", "max_uses": 0, "ttl": "168h" },
"install_command":
"curl -fsSL 'https://hub:7070/api/v1/fleet/install.sh?token=...' | sudo sh"
}Ometsuke's security guarantees — zero automatic enforcement, two-person (Four-Eyes) cryptographic approval immutability, Post-Quantum single-use enrollment and key rotation, cross-node Reverse RPC isolation, and tamper-evident audit chains — are formally specified in TLA+ and exhaustively checked across every reachable concurrent interleaving using the TLC explicit-state model checker (tla2tools.jar v1.7.4 / TLC 2.19).
Unit tests check individual execution paths; TLC exhaustively explores all concurrent worker schedules, out-of-order and duplicated network messages, clock ticks, and active attacker replays, producing a minimal counterexample trace whenever any safety invariant or temporal liveness property can fail.
#Verified Specification Matrix (TLC 2.19)
| Specification | Implementation Covered | Generated / Distinct States | Depth | Safety Invariants & Temporal Properties |
|---|---|---|---|---|
specs/tla/FourEyesSeal.tla | internal/domain/seal/foureyes.go, internal/adapter/sqlite/seals.go | 34,922 / 8,446 | 10 | NoSelfApproval, EnforceRequiresCryptoDualSeal, NoApprovalReplay, NoExpiredSeal, TerminalImmutability, AuditMonotonicity, liveness EventuallyResolved |
specs/tla/ZeroAutoEnforce.tla | internal/app/fleet/rollout.go, internal/domain/decision/ | 1,367,937 / 161,904 | 11 | ZeroAutoEnforceInvariant under adversarial AI/MCP agents & reordering networks, DesiredEnforceRequiresHumanSeal, MonotonicPolicyRevision |
specs/tla/PQFleetEnrollment.tla | internal/adapter/sqlite/fleet_pq.go, internal/app/fleet/ | 299,130 / 53,363 | 15 | SingleUseTokenEnforcement, NoAttackerHijack under leaked-token replay, RevokedNodeExcluded, NonceReplayIntegrity |
specs/tla/AuditHashChain.tla | internal/domain/audit/, internal/adapter/httpapi/compliance_gitops.go | 84,767 / 33,907 | 11 | UntamperedChainAlwaysValid, TamperAlwaysDetected, WORMNeverCertifiesTamperedChain |
specs/tla/ReverseRPCBroker.tla | internal/app/fleet/broker.go, internal/adapter/fleethttp/rpc.go | 5,005 / 1,098 | 10 | NoCrossNodeDelivery, SingleReplyPerCall, RevokedNodeNeverActive, CallResultImmutable, liveness EveryCallEventuallyTerminates |
specs/tla/PQKeyRotation.tla | internal/adapter/sqlite/fleet_pq.go, internal/app/fleet/ | 145,041 / 21,904 | 19 | OnlyActiveKeyAccepted, RevokedHasNoActiveKey, RotatedCompromisedKeyRejected, RevocationPermanent, MonotonicRotation |
Total exhaustively verified: 1,936,802 states generated, 280,622 distinct states, 0 invariant or temporal violations.
flowchart LR S["TLA+ Spec (6 Modules)"] --> TLC["TLC 2.19 Exhaustive BFS"] TLC -->|"1.93M states checked"| OK["0 Safety & Liveness Violations"] TLC -->|"Fault-injection / missing guard"| CE["Minimal Counterexample Trace"] CE --> FIX["Atomic SQLite CAS & Broker Binding"] FIX --> RACE["Go -race Regression Suite"]
#Real Bugs Caught by TLC Counterexamples
Formal modeling directly uncovered three real security and concurrency defects before production exposure, each confirmed via a minimal TLC counterexample trace and closed in Go with matching -race tests:
- Four-Eyes Seal TOCTOU overwrite (
TerminalImmutability):- Counterexample: Worker 1 (
bob, cosign) and Worker 2 (carol, reject) concurrently read the samepending_second_sealapproval. Worker 1 sealed it; Worker 2 then executedUPDATE four_eyes_seals SET ... WHERE id = ?without guardingstatus, overwriting an already-sealed cryptographic approval. - Fix: Atomic SQLite Compare-And-Swap (
WHERE id = ? AND status = 'pending_second_seal') ininternal/adapter/sqlite/seals.go, returningerrs.ErrConflict(HTTP 409) and verified byTestFourEyesApprovalAtomicCASPreventsConcurrentOverwrite.
- Counterexample: Worker 1 (
- Cross-Node Reverse RPC Reply Spoofing (
NoCrossNodeDelivery):- Counterexample: Hub dispatches RPC
c1tonode-a. A compromised peernode-blearnsc1and submits a valid PQ-signed reply. BecauseBroker.DeliverReplyoriginally routed solely byRequestIDwithout checkingpending.nodeID == reply.NodeID,node-b's forged payload was delivered to the caller awaitingnode-a. - Fix:
internal/app/fleet/broker.gonow bindspendingCall{nodeID, ch}and strictly rejects replies whose authenticatedNodeIDdoes not match the target node (TestBrokerRejectsCrossNodeReplySpoofing).
- Counterexample: Hub dispatches RPC
- Single-Use PQ Enrollment Token Conditional Guard (
SingleUseTokenEnforcement):- Fix:
ConsumeEnrollmentAndStoreCredininternal/adapter/sqlite/fleet_pq.goenforces the atomic conditional updateWHERE id = ? AND (max_uses = 0 OR uses_count < max_uses) AND revoked_at IS NULL AND expires_at > ?withRowsAffected() == 1as database-level defense-in-depth.
- Fix:
#Reproducing Formal Verification Locally
Run all 6 specifications with one command from the repository root:
./specs/tla/verify.shThe script downloads the official tlaplus/tlaplus v1.7.4/tla2tools.jar into /tmp/tla, verifies its SHA-256 digest (936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88), and runs TLC using either a local Java 21+ runtime or Docker eclipse-temurin:21-jre-alpine.
See Enterprise Governance, Fleet & Auth, and Security Policy for the runtime controls verified by these specifications.