gunk-dev/the-valley

dcr-de9d996-statement-text-and-signed-note.md

source933f202462e5main's published tip history
7.8 KiB · Rendered
1---
2type: decision
3id: dcr-de9d996
4status: decided
5title: A statement is written down as lines and signed as a note
6created: 2026-08-03
7source: design conversation, 2026-08-03
8---
9
10# A statement is written down as lines and signed as a note
11
12An attestation's statement — the typed record of what check ran, over what tree, with what result —
13is written down as lines, and it is signed as a note: that text, a blank line, and one signature
14line per signer. This node settles both halves of how an attestation is put on disk, because they
15are one question: the bytes a signature covers, and how a signature sits beside them.
16
17The written form is
18[design/verification.md](../../design/verification.md#a-statement-is-written-down-as-lines); the
19envelope is [the section after it](../../design/verification.md#the-envelope-is-a-signed-note). The
20statement's shape is [schema/attestation.cue](../../schema/attestation.cue), and the reference
21implementation is `attest/text.go` and `attest/sign.go`.
22
23## The written form is lines, and it has no escapes
24
25The first line names the form. Every line after it is a key, one space, and a value, sorted by key.
26A key is the path to the value with dots between segments, and a segment that is a number indexes an
27array.
28
29The property that matters is what the form leaves out: there is no escape mechanism. A value is
30written as its own bytes, so there is exactly one way to write it and nothing for two
31implementations to disagree about. Everything a line cannot carry is refused rather than escaped or
32dropped — a value holding a newline, an empty value, a number at a leaf, an empty object, a field
33name holding the dot or the space the form uses as separators.
34
35This is the whole of the specification. A serialization that admits escapes has to pin which escape
36each character gets, and that table is where independent implementations part company; a form with
37no table has no such surface. Refusing rather than dropping is what keeps the document that passed
38validation and the document that got signed the same document.
39
40## What is stored is what was signed
41
42An attestation is stored as one note, so what a reader gets back from the ref is the byte sequence
43that was signed with its signatures beneath it. There is no re-derivation step between what is
44stored and what is checked, and no encoding to decode before reading. A statement can be read with
45`git cat-file`, searched with `grep`, and vetted against the schema exactly as stored — the same
46plain-files property the knowledge graph has, applied to evidence.
47
48Reading the form back enforces every rule of it, so text that parses is text a renderer would have
49produced. A statement whose bytes are not the written form of what it says is refused even when its
50signature checks out, because that statement would fail to verify wherever it was written out again.
51The form is a rule rather than a convention, and a verifier settles it by reading rather than by
52trusting the sender.
53
54## Several signatures are sibling lines under one text
55
56Where more than one party attests to the same subject, their signatures are sibling lines beneath
57one statement. A signature therefore cannot be lifted onto a different statement: it sits under the
58text it covers, and moving it means moving that text with it. Composition is structural, not a rule
59a verifier has to remember to apply.
60
61This is the note format of `golang.org/x/mod/sumdb/note`, which is also the format transparency log
62checkpoints are published in. So the envelope that carries an attestation now carries a checkpoint
63later, and the transparency work of
64[roadmap.md, Phase 6](../../design/roadmap.md#phase-6--trust-backstop) does not change envelope at
65the boundary — the direction [[ida-d2dc957]]
66([ida-d2dc957-attestations-ride-on-a-transparent-leaf.md](../ideas/ida-d2dc957-attestations-ride-on-a-transparent-leaf.md))
67points at.
68
69A signature covers the text and nothing else — not the signer's name, not a namespace, and no git
70object, per [[ida-51605e8]]
71([ida-51605e8-authenticity-not-git-coupled.md](../ideas/ida-51605e8-authenticity-not-git-coupled.md)).
72What separates an attestation from any other note a key signs is the text's own first line, which is
73why the statement's written form opens by naming itself.
74
75## The signer is named, and a verifier holds names and hashes
76
77A note names its key by a string and a hash. The string a valley host uses is its fully qualified
78name, a slash, and what it is signing: `laddie.gunk.dev/attestations`. The host part says which
79machine to go and ask about a key; the suffix keeps a key signing attestations distinct, as a
80verifier key, from the same key signing anything else, because the name is inside the key hash.
81
82A verifier is given a set of known keys — one line each, carrying the name, the key hash and the
83public key. That is the whole interface: no allowed-signers file, no certificate, no directory
84lookup. A signature by a key not among them is a signature by nobody the verifier accepts, and a
85signature by one of them that does not check out refuses the whole note.
86
87The host signs with a raw Ed25519 key, which is the only algorithm a valley note carries.
88`/etc/ssh/ssh_host_ed25519_key` is the natural production identity, because the host already has it
89and it already says which host this is, but the key is a parameter and provisioning one is
90deployment.
91
92## The format is written out rather than depended on
93
94`golang.org/x/mod/sumdb/note` is the reference implementation of the envelope, and `attest` writes
95that format out again over `crypto/ed25519` instead of importing it.
96
97The format is frozen: it is what sum.golang.org publishes and what every checkpoint verifier already
98reads, so it cannot drift out from under a second implementation. Writing it out is about a hundred
99lines. Against that, a dependency graph's size is itself the exposure, and this program depends on
100nothing outside the standard library — it builds with no vendored modules, fetches nothing, and the
101whole of what it runs is in one directory. One module would end that property for code this short.
102
103Interoperability is bought by pinning bytes rather than by sharing code, which is the same trade the
104conformance vectors already make.
105
106## Conformance vectors are what hold a second implementation
107
108The written form and the note are an interop contract, so they are pinned by fixed files rather than
109by the code that happens to produce them. [attest/conformance/](../../attest/conformance/) holds
110statements and fragments paired with their exact text, notes that must verify — including one
111carrying two signatures — and the documents and texts that must be refused. The flake's
112`attest-conformance` check runs the whole set, and it holds the implementation to the reference one
113from the other side too: the unit tests re-derive the published key hash of sum.golang.org from its
114name and its public key, an answer the reference implementation already computed.
115
116A vector's recorded bytes may change only when the form itself changes, which invalidates every
117signature ever made under it.
118
119## Where this sits
120
121This refines `dcr-0de694f`, which fixes the attestation's five elements and lands on branch
122`dcr/phase2-attestation-shape`, by settling the two it leaves to the implementation: how a statement
123becomes the bytes a signature covers, and how those signatures are carried. Nothing above changes
124what a statement says, who signs it, or where it is stored.
125
126## Related
127
128- The statement, envelope and transparency layering this serves: [[ida-d2dc957]]
129 ([ida-d2dc957-attestations-ride-on-a-transparent-leaf.md](../ideas/ida-d2dc957-attestations-ride-on-a-transparent-leaf.md))
130- Why the signature covers the statement rather than a git object: [[ida-51605e8]]
131 ([ida-51605e8-authenticity-not-git-coupled.md](../ideas/ida-51605e8-authenticity-not-git-coupled.md))
132- The helper and what it verifies: [verification.md](../../design/verification.md#the-helper)