docker attestor
Parses docker buildx --metadata-file JSON output from the products and records image digests, references, and SLSA-style materials per architecture.
| Name | docker |
|---|---|
| Predicate type | https://aflock.ai/attestations/docker/v0.1 |
| Lifecycle | postproduct |
| Default binary? | No |
| Category | image-build (primary) |
| Recommended trace | full — benefits from full eBPF trace |
| Auto-attaches when |
|
The facts in this box are generated from the cilock binary's own catalog (cilock tools list). Do not hand-edit — run npm run gen:catalog.
What it captures
The top-level field is products, keyed by the image's SHA256 digest (without the sha256: prefix). Each DockerProduct entry contains:
imagedigest— aDigestSetholding the SHA256 of the container image (fromcontainerimage.digestin the metadata file).imagereferences— list of image refs (populated fromimage.namein the metadata file).materials—map[architecture][]Material, where eachMaterialhas:uri— the source material URI from buildx provenance.architecture— the platform key (e.g.linux/amd64), extracted from thebuildx.build.provenance/<arch>key or, for the single-archbuildx.build.provenancekey, parsed from theplatform=query parameter on the material URI.digest— aDigestSetcontaining the SHA256 from the provenance material.
Subjects() exposes four subject types: imagedigest:<sha256>, imagereference:<ref>, materialdigest:<sha256>, and materialuri:<uri>.
When to use
When your pipeline builds container images with docker buildx build --metadata-file <path> and that JSON file lands in the products. Pair with oci when you also docker save a tarball, or with slsa for SLSA-shaped consumers.
docker buildx build --metadata-file dist/metadata.json -t myapp:dev .
cilock run --step image \
--attestations command-run,material,product,docker \
-- echo "image built"
Flags
None.
Output shape
{
"products": {
"abc123...def": {
"materials": {
"linux/amd64": [
{
"uri": "https://github.com/example/repo.git#refs/heads/main",
"architecture": "linux/amd64",
"digest": { "sha256": "deadbeef..." }
}
]
},
"imagereferences": ["registry.example.com/myapp:dev"],
"imagedigest": { "sha256": "abc123...def" }
}
}
}
Gotchas
- Buildx only. Classic
docker builddoes not emit a metadata file withcontainerimage.digest/buildx.build.provenancekeys. Without those, nothing attests. - Detection is MIME-based, not filename-based. The attestor iterates
ctx.Products()and tries to JSON-parse every product whose MIME type isapplication/json. Files that fail to parse as aBuildInfostruct are silently skipped (logged at debug). There is no fixed filename — name the metadata file anything you like as long as the product MIME detector recognizes it as JSON. - Multiple metadata files per attestation are supported. Every JSON product that successfully unmarshals into a
BuildInfobecomes its own entry inproducts, keyed by image digest. - Digest must be
sha256:-prefixed. Metadata files whosecontainerimage.digestdoesn't start withsha256:are skipped with a warning. Attestreturns an error if no candidates produce a product ("no products to attest"). A buildx metadata file with a missing or non-sha256:digest will trip this if it's the only candidate.- Per-arch provenance keys. Multi-platform builds emit
buildx.build.provenance/<arch>entries; single-platform builds emit a barebuildx.build.provenancekey, and the architecture is recovered from theplatform=query parameter of one of the material URIs.
CLI example
Real docker buildx build --metadata-file metadata.json against a Dockerfile. The metadata file is a BuildKit JSON product consumed by the docker attestor.
cilock run --step docker-build \
--signer-file-key-path key.pem --outfile attestation.json \
--attestations docker,environment,git \
-- docker buildx build --metadata-file metadata.json --load -t app:latest .
Validated against a real built image (sha256:1c1ee1a2...). The --metadata-file flag produces a buildx JSON metadata that the docker attestor consumes as an application/json product. See the full real-data example at https://github.com/aflock-ai/attestor-compliance-examples/tree/main/16-docker.
See also
- Catalog row
oci— fordocker savetarballs (registry/distribution layout)- Upstream: witness/docker.md