Lesson 2 of 9 · 25m
Provenance and Attestations: Proving How the Artifact Was Made
Use SLSA-style provenance, in-toto attestations, and build metadata to connect artifacts back to source and build instructions.
A signature tells you who approved an artifact. Provenance tells you what the builder claims went into it. That distinction matters when the signing identity is legitimate but the build itself was manipulated. Attackers love this gap because the signature still verifies and everyone relaxes too early.
Provenance is a claim about construction
Useful provenance records the source repository, commit, workflow, builder, parameters, and materials:
{
"predicateType": "https://slsa.dev/provenance/v1",
"predicate": {
"buildDefinition": {
"buildType": "https://github.com/slsa-framework/slsa-github-generator/generic@v2",
"externalParameters": {"ref": "refs/tags/v2.4.1"},
"resolvedDependencies": [
{"uri": "git+https://github.com/acme/payments-api", "digest": {"gitCommit": "9f7c1d2"}}
]
},
"runDetails": {"builder": {"id": "https://github.com/actions/runner"}}
}
}This is not magic truth. It is structured evidence. Your job is to decide which claims the builder is trusted to make and then verify them.
Attestations travel beside the artifact
Cosign can attach signed attestations to an OCI image:
cosign attest --yes --predicate provenance.json --type slsaprovenance ghcr.io/acme/payments-api@sha256:3b8f4e4d...
cosign verify-attestation ghcr.io/acme/payments-api@sha256:3b8f4e4d... --type slsaprovenance --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp '^https://github.com/acme/payments-api/'The attestation is bound to the image digest. That is why digest references matter before provenance can mean anything.
Verify policy, not just signatures
A good deployment policy asks several questions:
Is the image signed by the release workflow?
Is provenance attached and signed by the same trusted identity?
Does provenance name the expected repository?
Does the commit belong to an approved branch or tag?
Was the build triggered by a release event rather than a pull request?
Are dependencies resolved from approved sources?The difference between hobby provenance and operational provenance is policy. If nobody checks the repository and ref, an attacker only needs a valid build from the wrong place.
Expect provenance gaps in real systems
Not every artifact comes from your ideal pipeline. Vendors ship signed binaries with no build metadata. Legacy jobs upload artifacts manually. Transitional controls are fine, but label them honestly. A manual provenance document written after the fact is inventory, not build evidence.
SLSA is a maturity model, not a badge
Higher SLSA levels mean the build platform makes forgery harder: isolated builders, immutable references, stronger provenance guarantees. Do not claim a level because a pipeline emits a JSON file. The level describes resistance to tampering, not file format compliance.
Field notes
- Reproducible builds are stronger evidence than provenance, but they are not always practical; use them where release binaries matter most.
- Treat provenance generated outside the build as low-trust metadata.
- Record dependency inputs as materials; otherwise a malicious transitive dependency can disappear from the evidence.
- Attestation payload size and registry support differ across ecosystems; test the whole path before promising enforcement.
- Verify the attestation subject digest. A valid attestation for another artifact proves nothing about yours.
Was this lesson helpful?