gunk-dev/the-valley

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

sourceb0d1e7d6db6bmain's published tip history
10.0 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, in the order a reader reads them
24
25The first line is the statement type. Every line after it is a key, one space, and a value. A key is
26the path to the value with dots between segments, and a segment that is a number indexes an array.
27
28The statement type is on the first line and nowhere else. It is the one thing a reader needs before
29anything else — what this document is, and which revision of it — and it is also what separates an
30attestation from any other note a key signs, because a signature covers the text alone. One line
31answers both.
32
33Lines are written in a fixed order: what the statement is about, then what kind of claim it makes,
34then the claim, then what produced the change. A statement is a document a reader reads in order to
35decide something, so the reader's first question is answered first. The claim's own order is per
36predicate type, because the claim reads differently for each: a pure claim reads as the check, its
37result, and then the three digests a verifier re-derives against; a notarization reads as the check,
38the environment it ran in, when that was, and what was observed. The order table is
39[design/verification.md](../../design/verification.md#line-order).
40
41Within a set keyed by names a caller supplies rather than the order table — a digest set, and any
42map added later — entries sort by key. Fixed order where position carries meaning, sorted order
43where it does not. An array is positional, so its elements are written in index order.
44
45A field with no position in the order has no written form and is refused. A new field's position
46therefore arrives with the field, and the predicate type is versioned, which is what lets a claim
47shape grow without moving what came before it. It also means only a whole statement has a written
48form, since order is defined per predicate type.
49
50## The form has no escapes
51
52A value is written as its own bytes, so there is exactly one way to write it and nothing for two
53implementations to disagree about. Everything a line cannot carry is refused rather than escaped or
54dropped — a value holding a newline, an empty value, a number at a leaf, an empty object, a field
55name holding the dot or the space the form uses as separators.
56
57A serialization that admits escapes has to pin which escape each character gets, and that table is
58where independent implementations part company; a form with no table has no such surface. Refusing
59rather than dropping is what keeps the document that passed validation and the document that got
60signed the same document.
61
62An empty container is refused for the same reason and has one consequence worth naming, because it
63reaches the shape of every statement. A field whose value is a list or an object with nothing in it
64has no lines, so it cannot be written down; a statement that wants to say "nothing" says it with a
65field carrying a value, and leaves the container out. Absence and emptiness are therefore not two
66ways of saying the same thing here: absence is how a statement declines to carry a field, and what
67the absence means is stated by the field beside it rather than inferred. A claim shape whose zero
68case has no line to say it in is a claim shape with documents it can validate and never sign.
69
70## What is stored is what was signed
71
72An attestation is stored as one note, so what a reader gets back from the ref is the byte sequence
73that was signed with its signatures beneath it. There is no re-derivation step between what is
74stored and what is checked, and no encoding to decode before reading. A statement can be read with
75`git cat-file`, searched with `grep`, and vetted against the schema exactly as stored — the same
76plain-files property the knowledge graph has, applied to evidence.
77
78Text is accepted only if writing the document it says back out reproduces it byte for byte, so text
79that parses is text a renderer would have produced. A statement whose bytes are not the written form
80of what it says is refused even when its signature checks out, because that statement would fail to
81verify wherever it was written out again. The form is a rule rather than a convention, and a
82verifier settles it by reading rather than by trusting the sender.
83
84## Several signatures are sibling lines under one text
85
86Where more than one party attests to the same subject, their signatures are sibling lines beneath
87one statement. A signature therefore cannot be lifted onto a different statement: it sits under the
88text it covers, and moving it means moving that text with it. Composition is structural, not a rule
89a verifier has to remember to apply.
90
91This is the note format of `golang.org/x/mod/sumdb/note`, which is also the format transparency log
92checkpoints are published in. So the envelope that carries an attestation now carries a checkpoint
93later, and the transparency work of
94[roadmap.md, Phase 6](../../design/roadmap.md#phase-6--trust-backstop) does not change envelope at
95the boundary — the direction [[ida-d2dc957]]
96([ida-d2dc957-attestations-ride-on-a-transparent-leaf.md](../ideas/ida-d2dc957-attestations-ride-on-a-transparent-leaf.md))
97points at.
98
99A signature covers the text and nothing else — not the signer's name, not a namespace, and no git
100object, per [[ida-51605e8]]
101([ida-51605e8-authenticity-not-git-coupled.md](../ideas/ida-51605e8-authenticity-not-git-coupled.md)).
102What separates an attestation from any other note a key signs is the text's own first line, which is
103the statement type.
104
105## The signer is named, and a verifier holds names and hashes
106
107A note names its key by a string and a hash. The string a valley host uses is its fully qualified
108name, a slash, and what it is signing: `laddie.gunk.dev/attestations`. The host part says which
109machine to go and ask about a key; the suffix keeps a key signing attestations distinct, as a
110verifier key, from the same key signing anything else, because the name is inside the key hash.
111
112A verifier is given a set of known keys — one line each, carrying the name, the key hash and the
113public key. That is the whole interface: no allowed-signers file, no certificate, no directory
114lookup. A signature by a key not among them is a signature by nobody the verifier accepts, and a
115signature by one of them that does not check out refuses the whole note.
116
117The host signs with a raw Ed25519 key, which is the only algorithm a valley note carries.
118`/etc/ssh/ssh_host_ed25519_key` is the natural production identity, because the host already has it
119and it already says which host this is, but the key is a parameter and provisioning one is
120deployment.
121
122## The format is written out rather than depended on
123
124`golang.org/x/mod/sumdb/note` is the reference implementation of the envelope, and `attest` writes
125that format out again over `crypto/ed25519` instead of importing it.
126
127The format is frozen: it is what sum.golang.org publishes and what every checkpoint verifier already
128reads, so it cannot drift out from under a second implementation. Writing it out is about a hundred
129lines. Against that, a dependency graph's size is itself the exposure, and this program depends on
130nothing outside the standard library — it builds with no vendored modules, fetches nothing, and the
131whole of what it runs is in one directory. One module would end that property for code this short.
132
133Interoperability is bought by pinning bytes rather than by sharing code, which is the same trade the
134conformance vectors already make.
135
136## Conformance vectors are what hold a second implementation
137
138The written form and the note are an interop contract, so they are pinned by fixed files rather than
139by the code that happens to produce them. [attest/conformance/](../../../attest/conformance/) holds
140statements paired with their exact text, notes that must verify — including one carrying two
141signatures — and the documents and texts that must be refused. The flake's `attest-conformance`
142check runs the whole set, and it holds the implementation to the reference one from the other side
143too: the unit tests re-derive the published key hash of sum.golang.org from its name and its public
144key, an answer the reference implementation already computed.
145
146A vector's recorded bytes may change only when the form itself changes, which invalidates every
147signature ever made under it.
148
149## Where this sits
150
151This refines [[dcr-0de694f]]
152([dcr-0de694f-phase2-attestation-shape.md](./dcr-0de694f-phase2-attestation-shape.md)), which fixes
153the attestation's five elements, by settling the two it leaves to the implementation: how a
154statement becomes the bytes a signature covers, and how those signatures are carried. Nothing above
155changes what a statement says, who signs it, or where it is stored.
156
157## Related
158
159- The statement, envelope and transparency layering this serves: [[ida-d2dc957]]
160 ([ida-d2dc957-attestations-ride-on-a-transparent-leaf.md](../ideas/ida-d2dc957-attestations-ride-on-a-transparent-leaf.md))
161- Why the signature covers the statement rather than a git object: [[ida-51605e8]]
162 ([ida-51605e8-authenticity-not-git-coupled.md](../ideas/ida-51605e8-authenticity-not-git-coupled.md))
163- The helper and what it verifies: [verification.md](../../design/verification.md#the-helper)