Skip to main content

Module format

Module format 

Source
Expand description

The attestation format: the payload’s fields, the note’s blocks, and the names every producer and verifier shares (SPEC.md, “The note”).

Structs§

Block
One signed statement out of a note: the exact bytes that were signed (trailing newline included) and the armored signature over them.

Constants§

FORMAT
First token of every payload. A verifier that does not recognise this string must treat the note as absent: an unknown version may mean anything, and “run the tests” is the only safe reading of anything.
INPUTS_REF
The second notes ref, keyed by input fingerprint rather than by object. Every key there is a synthetic oid that is not an object, which is why it is a separate ref: git notes prune on it would drop everything, and the main ref keeps its 1.x invariant that every key is real.
LOCAL_PREFIX
Where sign.sh --no-push keeps blocks that never reached origin, under refs/notes/, prefixed to either ref name above. Origin cannot revoke them, so a verifier reads them only when asked (--include-local).
MAX_BLOCKS
How many blocks of one note are read. Every block costs two ssh-keygen runs, and the notes ref is writable by anyone with push access.
NAMESPACE
The ssh-keygen -Y namespace. Namespaces exist so a signature minted for one purpose cannot be replayed for another; an allowed_signers entry pinned to this namespace accepts nothing else.
NOTES_REF
The notes ref, as git notes --ref wants it.

Functions§

block
A signed block as a note holds it: the payload without its trailing newline, a blank line, the armored signature without its own.
canon_claim
The canonical fingerprint a block claims: a canon <oid> line of exactly two blank-separated fields, first occurrence wins. A malformed oid is not a claim.
field
Read a payload field BY PREFIX, never by line position: the payload has grown a line once already (v1 -> v2 added platform), and a positional reader silently mis-assigns every field after an insertion rather than failing. First match wins, so a second gates line cannot smuggle a value past the caller.
input_fp
The fingerprint a block claims for gate: an input <gate> <fp> line of exactly three blank-separated fields, first occurrence wins. Byte-strict like field; a fourth field or a malformed oid is not a claim.
is_oid
A 40- or 64-hex object id, as hash-object prints one.
payload
The payload of an attestation, in the exact shape SPEC.md gives: tree, gates, platform, the input lines in spec order, canon, then the producer line, each followed by LF. The same inputs give the same bytes, so a re-run recognises its own block.
platform
Where a suite ran, as <arch>-<os>. Coarser than a target triple on purpose: the libc flavour is not something std can answer, and the question a CI matrix actually asks is “did this run on MY leg”.
platform_matches
Does an attestation minted on ran_on satisfy what the caller asked for?
split_blocks
A note into its blocks. Since 1.2.0 a note may hold several — a laptop’s and a CI job’s, each on its own platform — separated by blank lines, which is exactly what git notes append produces.
split_note
The first block of a note, as payload and signature.