Documentation
¶
Overview ¶
Package release builds the manifest that lets a CubeCOS node decide whether the agent binary it is about to run is the one Bigstack released.
The format is dictated by where it gets checked. The verifier lives in cubecos, not here — a verifier must not share a build pipeline with the artifact it verifies, or one compromised pipeline defeats both (ADR 0003) — and it is plain shell, small enough that a reviewer can read all of it:
openssl dgst -sha384 -verify release.pub -signature manifest.txt.sig manifest.txt
openssl pkeyutl -verify -rawin -pubin -inkey release-mldsa87.pub \
-in manifest.txt -sigfile manifest.txt.mldsa87.sig
sha256sum -c manifest.txt
So the manifest is exactly what sha256sum already understands, with metadata carried in comment lines that sha256sum ignores. Nothing on the verifying side parses a bespoke format, because a bespoke parser in shell is where the bugs would be.
This lives in pkg/ rather than internal/ because the format has three consumers in three repositories: this one produces it, the SaaS signs and serves it, and cubecos verifies it. Anything crossing a repository boundary belongs in pkg/ — an unimportable contract gets restated on the other side, and then there are two of them.
Index ¶
Constants ¶
const ( ManifestName = "manifest.txt" SignatureName = "manifest.txt.sig" MLDSASignatureName = "manifest.txt.mldsa87.sig" )
Names of the files a release publishes alongside its artifacts. A release is signed twice, and a node requires both: ECDSA P-384 over SHA-384 and ML-DSA-87.
Variables ¶
This section is empty.
Functions ¶
func IsReleaseMetadata ¶
IsReleaseMetadata reports whether name is the manifest or one of its signatures rather than an artifact.
func WriteManifest ¶
WriteManifest renders m into dir.
Types ¶
type Artifact ¶
type Artifact struct {
Name string // base name as published, e.g. cube-advisor-agent_linux_amd64
SHA256 string // lowercase hex
}
Artifact is one released file.
No size field: the manifest's format is sha256sum's, which has no column for one, so a size here could only ever be set and never published — and a number that is carried but never checked invites being trusted.
type Manifest ¶
type Manifest struct {
Version string // release version, e.g. 0.2.0
Commit string // git commit the artifacts were built from
ProtocolVersion int // tunnel protocol this agent speaks
Artifacts []Artifact
}
Manifest describes one release.
func Build ¶
func Build(dir string, want []string, version, commit string, protocolVersion int) (Manifest, error)
Build produces a manifest for exactly the artifacts named in want.
Both directions are errors, and deliberately so, because signing is an assertion about what this release contains:
- A named artifact that is not there fails. This is the property the earlier directory walk was protecting — a release must not silently omit an architecture — kept by making the caller's build list the one source of truth rather than a second pattern that can drift from it.
- A file in dir that was not asked for fails, rather than being signed in. A stale binary from an earlier run with different targets would otherwise become a manifest entry with no build behind it, and the node-side verifier requires every entry of a whole-release check to be present — so that release could never verify again.
The manifest and its signatures are not artifacts and are skipped: a manifest cannot contain its own digest.
func ParseManifest ¶
ParseManifest reads a rendered manifest back.
Used by the SaaS when serving a release and by tests; the node-side verifier deliberately does not parse it at all.
func (Manifest) Render ¶
Render writes the manifest in sha256sum's own format.
Comment lines (leading '#') carry the metadata; sha256sum -c skips them, so the same bytes are both a machine-checkable digest list and a human-readable record of what this release is. Artifacts are sorted so the same inputs always produce byte-identical output — a manifest that varies run to run cannot be reproduced by anyone checking our work.