Sub topic 4
Attestations as signed-ready in-toto statements
This chapter assumes you know the SBOM and provenance concepts from the previous chapters. You should also be comfortable reading JSON with jq and know that an image has a content digest. Here you will learn what a BuildKit attestation looks like on the inside and why it is described as "signed-ready" rather than signed.
Why a common format is needed
An SBOM lists packages. A provenance record describes a build. These are different documents with different schemas. A consumer still wants to ask the same question of both: what exact artifact does this statement describe, and what kind of claim is it?
The in-toto attestation framework answers that with a small, fixed outer structure. Every claim is wrapped in the same envelope, and only the inner part changes. BuildKit uses this framework for both SBOM and provenance. Verification tools can then handle both with one code path.
The anatomy of an in-toto statement
An in-toto statement is a JSON object with four fields.
| Field | Meaning |
|---|---|
| `_type` | The version of the statement format. |
| `subject` | A list of artifacts the statement is about, each with a name and digests. |
| `predicateType` | A URI that says what kind of claim the predicate holds. |
| `predicate` | The claim itself. Its schema is defined by `predicateType`. |
The subject says what the claim is about. The predicate type says what kind of claim it is. The predicate is the claim. A reader checks the first two before trusting the third.
Here is a trimmed provenance statement of the kind BuildKit produces. The digest is a placeholder.
{
"_type": "https://in-toto.io/Statement/v0.1",
"subject": [
{
"name": "_",
"digest": {
"sha256": "0b6c1e4a5f8d3c2b9a7e6d5c4b3a2918f7e6d5c4b3a29180f1e2d3c4b5a6978"
}
}
],
"predicateType": "https://slsa.dev/provenance/v0.2",
"predicate": {
"builder": { "id": "" },
"buildType": "https://mobyproject.org/buildkit@v1",
"invocation": {
"configSource": { "entryPoint": "Dockerfile" }
},
"materials": [
{ "uri": "pkg:docker/[email protected]" }
]
}
}Three details matter here.
- The subject is a digest, not a tag. BuildKit sets the subject name to
_and fills in the digest of the image manifest. The digest is what binds the statement to one specific image. A tag can move to a different image, so it proves nothing. - The predicate type URI selects the schema. For SBOMs, BuildKit's default scanner emits SPDX, so the predicate type is
https://spdx.dev/Document. For provenance, the URI is a SLSA provenance URI. Newer BuildKit versions can emit the v1 schema, so readpredicateTypefrom the statement instead of assuming one. - The statement version and predicate version are independent.
Statement/v0.1describes the outer wrapper. The predicate schema has its own version.
One statement per platform
A multi-platform image has one manifest per platform. Each platform has its own digest, so each gets its own statements. The subject of a statement is the manifest of one platform, not the whole index. Two platforms with the same SBOM content still produce two statements with different subjects.
The shape below shows how the pieces relate.
Where the statement lives
BuildKit does not store a statement as a loose file. It packs it as an OCI image manifest. The layer of that manifest holds the statement JSON, with media type application/vnd.in-toto+json. The layer carries an annotation, in-toto.io/predicate-type, that repeats the predicate type. A tool can then pick out the SBOM or the provenance without downloading and parsing every layer.
These attestation manifests are listed in the image index next to the real image manifests. An annotation marks them. You can see the markers with the raw index:
docker buildx imagetools inspect registry.example.com/demo/app:1.0 --raw \
| jq '.manifests[] | select(.annotations["vnd.docker.reference.type"] == "attestation-manifest")'Each result carries vnd.docker.reference.digest. That annotation names the image manifest the attestation describes. The same pointer appears inside the statement as the subject digest. So the link is recorded twice, once in the index and once in the signed-ready content.
The next chapters cover the storage layout and the inspection commands in full. For now, note that the storage format and the statement format are separate layers. The index is registry plumbing. The statement is the claim.
What "signed-ready" means
BuildKit attestations are not signed. The statement is stored as plain JSON in the layer. Nothing in it proves who produced it.
The in-toto format is designed so a signature can be added without changing the content. The usual wrapper is a DSSE envelope (Dead Simple Signing Envelope):
{
"payloadType": "application/vnd.in-toto+json",
"payload": "<base64 of the statement JSON>",
"signatures": [
{ "keyid": "example-key", "sig": "<base64 signature>" }
]
}The signer signs the statement bytes, together with the payload type. A verifier checks the signature, decodes the payload, and then reads the statement. Because the statement already has a fixed subject and predicate type, the signer does not need to know anything about SBOMs or SLSA.
So "signed-ready" means three things:
- The content is in a standard shape that signing tools already understand.
- The subject is a digest, so a signature on the statement covers one exact image.
- No extra conversion is needed before signing. A later step supplies the signature and the trust decision.
The chapter on signing and policy checks covers that later step.
Reading the type before the content
A common error is to read predicate and ignore the rest. Make these checks first:
- Check
_type. Confirm that your tool understands this statement version. - Check
predicateType. A provenance parser run against an SPDX document gives meaningless output. - Check
subject[].digest. Compare it with the digest of the image you are about to deploy. A statement for a different digest is not evidence about your image. - Then read
predicate.
You can extract the first three fields from a statement you have saved to statement.json:
jq '{type: ._type, predicateType: .predicateType, subject: .subject}' statement.jsonExpected output has the shape below, with your own digest:
{
"type": "https://in-toto.io/Statement/v0.1",
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"name": "_",
"digest": {
"sha256": "0b6c1e4a5f8d3c2b9a7e6d5c4b3a2918f7e6d5c4b3a29180f1e2d3c4b5a6978"
}
}
]
}Common errors
- Assuming a tag in the subject. The subject is a digest. A tool that matches on tag names will fail to match.
- Comparing the index digest to the subject digest. The subject is the platform manifest digest, not the index digest. For a multi-platform image, compare against the matching platform entry.
- Expecting a signature. Nothing here is signed. A missing
signaturesfield is normal, because there is no envelope yet. - Hard-coding a predicate version. Different BuildKit and Buildx releases may emit different SLSA schema versions. Branch on
predicateType.
Exercise
A statement has subject[0].digest.sha256 equal to the digest of the amd64 manifest of an image. You are deploying the arm64 variant of the same tag. Can you use this statement as evidence about the arm64 image, and why?
Show answer
No. The subject binds the statement to one platform manifest digest. The arm64 manifest has a different digest, so it has its own statement. Using the amd64 statement would describe a different artifact.
Exercise
Name the four top-level fields of an in-toto statement. Which one tells a tool how to parse the predicate?
Show answer
_type, subject, predicateType and predicate. The predicateType URI tells a tool which schema the predicate follows.
Exercise
Why are BuildKit attestations described as "signed-ready" and not "signed"?
Show answer
They are plain in-toto statements with a digest subject and a typed predicate, which is the form signing tools expect. BuildKit does not add a DSSE envelope or signature, so a later step must sign them and a verifier must check a policy.