Sub topic 4
Attestations as Signed-Ready in-toto Statements
This chapter assumes you know what an SBOM and build provenance are, and that you can read JSON with jq. It explains the format that wraps both: the in-toto attestation. You need this format to read the output of later chapters.
What an attestation is
An attestation is a claim about a software artifact, written as structured data. An SBOM says "this image contains these packages". A provenance record says "this image was built from this source by this builder". Both are claims, so BuildKit stores them in one shared format instead of two custom ones.
That format comes from the in-toto project. An in-toto attestation is a JSON document called a statement. A statement binds a claim to a specific artifact.
The structure of a statement
A statement has four fields.
| Field | Meaning |
|---|---|
| `_type` | The statement format version, for example `https://in-toto.io/Statement/v0.1`. |
| `subject` | The artifact the claim is about. Each subject has a name and a `digest`. |
| `predicateType` | A URI that says what kind of claim follows. |
| `predicate` | The claim itself. Its shape depends on `predicateType`. |
The subject uses a content digest, not a tag. A tag such as 1.0 can be moved to another image. A digest cannot, so the claim stays tied to exactly one image.
The predicate type tells a consumer how to parse the predicate. BuildKit uses these types:
- SBOM:
https://spdx.dev/Document(SPDX format, the default scanner output). - Provenance:
https://slsa.dev/provenance/v0.2orhttps://slsa.dev/provenance/v1, depending on the BuildKit version.
Here is a trimmed provenance statement:
{
"_type": "https://in-toto.io/Statement/v0.1",
"subject": [
{
"name": "pkg:docker/registry.example.com/demo/[email protected]?platform=linux%2Famd64",
"digest": { "sha256": "3f1c0a5e9d7b2c64a8e1f0b9d2c7a4e5f6b8091a2c3d4e5f60718293a4b5c6d7" }
}
],
"predicateType": "https://slsa.dev/provenance/v0.2",
"predicate": {
"builder": { "id": "" },
"buildType": "https://mobyproject.org/buildkit@v1",
"invocation": { "configSource": {}, "parameters": {} }
}
}The digest and fields above are illustrative. Real output has many more fields.
Why "signed-ready"
A statement is plain JSON, so anyone can write one. On its own it proves nothing about who made it. The in-toto design puts the statement inside an envelope, a wrapper that carries a signature over the statement's bytes. The common envelope is DSSE (Dead Simple Signing Envelope).
A statement is therefore ready to be signed, but BuildKit does not sign it. The attestations from docker buildx build are unsigned. A tool such as Cosign can sign them later. A later chapter covers that step and its limits.
This split has a practical benefit. The build produces the claim, and a separate step decides who vouches for it. You can add signing, policy checks, or both without changing how the build works.
How the pieces connect
Reading a statement in practice
When you inspect a pushed image, as shown in a later chapter, the output is built from these fields. Two checks are useful on any statement:
- Confirm the
subjectdigest matches the image you are about to deploy. - Confirm the
predicateTypeis the one you expect before you trust the shape of thepredicate.
A mismatch on either point means the statement does not describe your image, or is not the kind of claim you assumed.
Exercise
A colleague says an SBOM attached to your image proves the package list is authentic. Using the statement structure, give two reasons the claim needs more than the statement alone.
Show answer
First, a statement is plain JSON and unsigned, so nothing shows who produced it. Without a signature in an envelope such as DSSE, anyone could write one. Second, the statement only describes the image named by its subject digest. You must check that this digest matches the image you deploy, and that the predicateType is the SBOM type you expect.