gunk-dev/the-valley

verification.md

sourcee1a293f6bde4main's published tip history
4.2 KiB · Rendered
1# Verification
2
3The reframe — attestation-with-revocation instead of CI-as-gate, and the failure-mode trade it makes
4— is an architecture bet; see [architecture.md](./architecture.md). This document holds what the
5attestation phase actually needs: the two kinds of checks, and what makes an attestation hard to
6forge.
7
8## Two kinds of checks, two kinds of attestation
9
10The system must distinguish what an attestation is claiming. A single "checks passed" signature is
11the SLSA mistake worth avoiding.
12
13- **Pure checks** — `nix build`, `nix flake check`, lint/type-check as derivations,
14 `nixosTest`-style integration tests (effectful inside, pure outside). Inputs content-addressed,
15 outputs deterministic; the attestation carries input, derivation, and output hashes, so **any
16 verifier can re-derive and confirm**. These are the strong attestations.
17- **Effectful checks** — real-network tests, external APIs, benchmarks, anything not
18 bit-reproducible. The attestation is a notarization: "sealed environment $E ran $T at time $t and
19 observed $result." Trust here is closer to "I trust the signer."
20
21Wherever a check can be moved from effectful to pure (via `nixosTest` or microVM sandboxing), it
22should be.
23
24## The mechanism stack
25
26Without a TEE, attestations are exactly as trustworthy as the signing key — the same trust model as
27code signing, plenty for non-adversarial settings. But the mechanisms stack:
28
29| Mechanism | What it gets you | Residual attack |
30| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
31| Signing key | "The signer says these checks passed" | Anyone with the key can lie |
32| Content-addressed attestation tool | The tool itself is a known Nix derivation; the attestation names its hash | Malicious dev can ship a patched tool, but it will not match the canonical hash |
33| Hermetic sandbox | `nix build` sandbox; `nixosTest` VMs; microVMs for non-Nix checks | Local root can still bypass — but bypass leaves evidence |
34| Re-derivation audit | Pure attestations encode every input hash; verifier re-runs and confirms bit-identical | None for pure checks; effectful checks not re-verifiable |
35| Witness sampling | Random fraction of attestations re-run on another node; trust score per attester | None — this is the backstop |
36| Transparency log (Tessera-backed) | Every attestation appended to an external append-only log with an inclusion proof; anyone can audit existence and content over time | Orthogonal to the others — gives non-repudiation and tamper evidence, not correctness of the computation. Independent and complementary. |
37
38Stacked, a determined local-root actor can still forge an attestation — but only visibly (tool hash
39mismatch), temporarily (re-derivation eventually detects), and within a bounded window (before their
40trust score is recalculated). For pure-derivation checks this lands roughly at SLSA Level 3; for
41effectful checks, lower — but the system knows which kind each attestation is.