Sub topic 14
Limitations and the trust model of unsigned attestations
This chapter assumes you can already build an image with --sbom=true and --provenance=mode=max, push it, and read the result with docker buildx imagetools inspect. It also assumes you know that an image tag points to an index, and that the index points to manifests by digest. The goal here is to be precise about what those attestations prove, what they only claim, and where they can mislead you.
What an unsigned attestation actually is
BuildKit stores each attestation as a manifest in the image index, next to the image manifests. Each attestation manifest names the image manifest it describes by digest. Its content is an in-toto statement: a subject, a predicate type, and the predicate itself (an SPDX document for the SBOM, a SLSA record for provenance).
Nothing in that structure is cryptographically protected. There is no signature over the statement, and the registry does not check that the statement is true. The attestation is a JSON file that the builder wrote and the registry stored.
This gives you a simple rule. An unsigned attestation tells you what the builder said, not what is true. Whether you can believe it depends on who could have written or changed it.
Who can write or change the data
Anyone with push access to the repository can add a manifest to an index or replace the whole index. You can see how the links work by listing the index:
docker buildx imagetools inspect registry.example.com/demo/app:1.0 --raw \
| jq '.manifests[] | {
digest,
platform,
type: .annotations["vnd.docker.reference.type"],
describes: .annotations["vnd.docker.reference.digest"]
}'Image manifests show a real platform such as linux/amd64 and no annotations. Attestation manifests show the platform unknown/unknown, the type attestation-manifest, and the digest of the image manifest they describe.
An attacker with write access can push a new image manifest and a matching attestation manifest that says whatever they like. The link by digest keeps the pair consistent, but it does not show that the claims are honest. The same holds for a stolen CI token, a compromised mirror, or a misconfigured registry with open write permissions.
Tags are not identities
An attestation is attached to an index digest, not to a tag. The tag 1.0 can be moved to a different index at any time, and that index may carry different attestations or none.
If you verify metadata for app:1.0 today, you have verified that tag at this moment. To get stable results:
- Resolve the tag to a digest once, and record it.
- Fetch and check the attestations by that digest (
app@sha256:...). - Deploy by digest, so the thing you checked is the thing you run.
docker buildx imagetools inspect registry.example.com/demo/app:1.0 \
--format '{{ json .Manifest.Digest }}'Use the printed digest in later commands and in your deployment manifests.
The provenance is self-reported
BuildKit writes the provenance while it runs the build. The record lists the build's inputs, such as the Dockerfile, the source, the base image digests, and (in max mode) the build arguments. It describes the build as BuildKit saw it.
If the builder itself is compromised, it can write false provenance. An attacker who controls the build machine can change the output and the record together. The attestation then agrees with the tampered image.
The SLSA framework separates levels by how much you can trust the provenance. In broad terms:
| Property | Plain BuildKit attestation | What higher assurance needs |
|---|---|---|
| Provenance exists | Yes | Yes |
| Provenance is signed | No | Signed by the build platform's identity |
| Builder is isolated from the build's own steps | Depends on your setup | A hardened, ephemeral builder the build cannot influence |
| Provenance cannot be forged by the build's own steps | Not guaranteed | Required at the highest levels |
Treat BuildKit's output as a good, structured record, and as the first step toward a stronger level. It is not a proof by itself. Check the current SLSA specification for the exact level definitions before you make compliance claims.
What the provenance does not tell you
Provenance records inputs. It does not judge them.
- Base images. It lists the base image digest. It says nothing about whether that base image is safe or was itself built honestly.
- Local contexts. If you build from a local directory instead of a Git URL, the provenance cannot point to a commit. You learn that a build happened, but not which source revision it used.
- Network fetches. A
RUN curl ... | shstep may be recorded as a command, but the downloaded content is not pinned or hashed in the record. The content could change between builds. - Reproducibility. A provenance record does not make the build reproducible. The record contains timestamps and other values that differ from run to run.
Provenance modes and data exposure
The mode you pick decides how much the record reveals. Max mode includes build arguments and details of the build graph. Min mode leaves most of that out.
Secrets mounted with --secret are not written to the record. Build arguments are, in max mode. A token passed with --build-arg TOKEN=... ends up in the attestation, and the attestation is stored in the registry, often readable by everyone who can pull the image.
# Risky: the value becomes part of a max-mode provenance record
docker buildx build \
--provenance=mode=max \
--build-arg API_TOKEN="$API_TOKEN" \
--tag registry.example.com/demo/app:1.0 --push .
# Safer: use a build secret, which is not recorded
docker buildx build \
--provenance=mode=max \
--secret id=api_token,env=API_TOKEN \
--tag registry.example.com/demo/app:1.0 --push .SBOM limits
The SBOM comes from a scanner, by default a Syft-based scanner image. It inspects the files in the built image and the metadata that package managers leave behind. That has consequences:
- Detection is best effort. Packages installed through a package manager (apk, dpkg, language lockfiles and manifests) are found well. A binary copied in with no metadata may be missed or only partly identified.
- Vendored or renamed code is invisible. Source code copied into the tree, or libraries with edited metadata, does not show up as a component.
- It is a snapshot. The SBOM says what was in the image at build time. It does not list vulnerabilities, and new vulnerabilities appear later. You must match the SBOM against fresh vulnerability data repeatedly.
- The scanner is part of the trust chain. The scanner is a container image that runs during your build. Pin it explicitly, and by digest if you need stable results, so a moved tag does not change your output.
docker buildx build \
--attest type=sbom,generator=docker/buildkit-syft-scanner:stable-1 \
--attest type=provenance,mode=min \
--tag registry.example.com/demo/app:1.0 \
--push .By default only the final stage is scanned. Content that exists only in earlier stages or in the build context is covered only if you enable the stage and context scanning options from the earlier chapter.
Operational limits
Some failures have nothing to do with trust and still matter:
- Registry and tool support. The attestation manifests have the platform
unknown/unknown. Some registries, mirrors, and older tools reject them or list them as extra images. If a consumer breaks, you can turn provenance off with--provenance=false, but you then lose the record. - Builder support. Attestations need a builder that supports them, such as the
docker-containerdriver or a containerd-backed image store. The classic Docker image store cannot hold them, so a locally loaded image has none. - Image rewriting. Copying an image with a tool that handles only a single platform manifest drops the attestations. A copy that keeps the full index keeps them.
- Size and noise. Max-mode provenance and large SBOMs add data to every image you push, for every platform.
Putting it together
The following diagram shows where trust can break between a source change and a running container.
The next step: signing and policy
Signing closes the biggest gap. A signature made by a known identity, such as a CI workflow's key or a keyless certificate, lets a consumer check who produced the attestation and that nobody changed it afterward. The consumer then applies a policy to the content: the source repository must match, the builder must be the expected one, and no unexpected build arguments may appear.
Signing does not fix everything. A signature over false provenance from a compromised builder is still false. It narrows the question from "did anyone tamper with this file?" to "do I trust the identity that signed it, and the builder behind that identity?" The previous chapter covered the mechanics of signing and verification. Use that chapter together with the limits above.
Exercise
A teammate says: "The image has a max-mode provenance attestation that names our repository and commit, so we know the image was built by our pipeline." What is wrong with this claim, and what would you need to make it reasonable?
Show answer
The attestation is unsigned and self-reported. Anyone with push access to the registry, or anyone controlling the builder, could write a record naming your repository and commit. To make the claim reasonable you need a signature from an identity you trust (for example, your CI workflow), a verification step that checks that identity, a policy check on the content, and a deployment that uses the digest so the verified object is the one that runs. You also need confidence that the builder itself is isolated from the build steps.
Exercise
You run a build with --provenance=mode=max --build-arg DB_PASSWORD=hunter2. Name the problem, and give two actions to take.
Show answer
Max mode records build arguments, so the password is stored in the provenance attestation in the registry and may be readable by anyone who can pull the image. Treat the password as leaked and rotate it. Then change the build to pass the value with --secret and a RUN --mount=type=secret step, which is not recorded in the attestation. Optionally, also review what is in the existing pushed attestations and remove or replace the affected image.
Exercise
A scan of an image's SBOM shows no vulnerable components today. Three months later a new vulnerability is published for a library the image contains. Why can the same SBOM still be useful, and what limit remains?
Show answer
The SBOM lists the components that were found, so you can match it against new vulnerability data later without rebuilding. The limit is that the SBOM is a best-effort snapshot. Components that the scanner missed, such as vendored code or binaries without metadata, are not listed, so a clean match does not prove the image is free of the vulnerable library.