Sub topic 3
Anatomy of a provenance attestation
This chapter assumes you know basic GitHub Actions workflows, what a SHA-256 hash is, and the general idea of a digital signature. You will take apart a provenance attestation, field by field, so that you know what a consumer is checking when verification passes. Signing and identity get their own chapters. Here the focus is on the content being signed.
What an attestation is
An attestation is a signed statement about a software artifact. It says: "this claim is true of the artifact with this digest." Two things make it useful. The claim is tied to the artifact by a hash, and the claim is signed so that the author can be identified.
Provenance is one kind of claim. It records where an artifact came from: which source repository and commit, which build workflow, which runner, and which triggering event. Compare this with a checksum file next to a download. A checksum tells you the file was not corrupted. Provenance tells you who built it and how.
Attestations use three nested layers. Each layer has one job.
| Layer | Standard | Job |
|---|---|---|
| Statement | in-toto Statement | Binds a claim (predicate) to one or more artifacts (subjects) by digest |
| Predicate | SLSA Provenance | Describes how the artifact was built |
| Envelope | DSSE | Wraps the statement with a signature |
The in-toto statement
in-toto is a framework for describing supply chain steps. Its Statement format is a small JSON document with four top-level fields:
_type: the statement format version, such ashttps://in-toto.io/Statement/v1.subject: a list of artifacts the statement is about. Each has anameand adigestmap.predicateType: a URI that says what kind of claim follows, and therefore how to read it.predicate: the claim itself. Its structure depends onpredicateType.
The statement for the binary built in the earlier workflow looks like this. Digests are shortened here.
{
"_type": "https://in-toto.io/Statement/v1",
"subject": [
{
"name": "app",
"digest": { "sha256": "9f2c0e...a41b" }
}
],
"predicateType": "https://slsa.dev/provenance/v1",
"predicate": {
"buildDefinition": {
"buildType": "https://actions.github.io/buildtypes/workflow/v1",
"externalParameters": {
"workflow": {
"ref": "refs/tags/v1.4.0",
"repository": "https://github.com/OWNER/REPO",
"path": ".github/workflows/build.yml"
}
},
"internalParameters": {
"github": {
"event_name": "push",
"runner_environment": "github-hosted"
}
},
"resolvedDependencies": [
{
"uri": "git+https://github.com/OWNER/REPO@refs/tags/v1.4.0",
"digest": { "gitCommit": "3b1d7c...e90f" }
}
]
},
"runDetails": {
"builder": {
"id": "https://github.com/OWNER/REPO/.github/workflows/build.yml@refs/tags/v1.4.0"
},
"metadata": {
"invocationId": "https://github.com/OWNER/REPO/actions/runs/123456789/attempts/1"
}
}
}
}The exact set of fields GitHub fills in can change between versions of the action, so treat this as a representative shape and read a real attestation from your own build when you need the details.
Subject: the link to the artifact
The subject is the only connection between the claim and the file you hold. A consumer computes the SHA-256 digest of the downloaded file and looks for a statement whose subject has the same digest. The name field is a label. Verification does not rely on it, so a file renamed after download still matches.
A statement can list several subjects. One build step that produces many files can be covered by one attestation. For container images, the subject is the image digest, which is covered in a later chapter.
Because the match is by digest, attestations are immutable in effect. If you rebuild and the bytes differ, the new file has a new digest and needs its own attestation. This matters for builds that are not reproducible: two builds of the same commit can produce different digests, and each needs its own attestation.
Predicate type: how to read the claim
predicateType tells a consumer which schema the predicate follows. For build provenance the type is https://slsa.dev/provenance/v1. An SBOM attestation uses an SPDX or CycloneDX type, and a custom attestation uses a type you define. Tools filter on this field. For example, gh attestation verify looks for SLSA provenance by default and can be told to look for other types.
The SLSA provenance predicate
The SLSA Provenance v1 predicate has two main sections.
buildDefinition: what was asked for
buildDefinition describes the inputs to the build.
buildTypeis a URI that defines how to interpret the other fields. For GitHub Actions workflows it points to a build type published by GitHub.externalParametersare inputs that a user or trigger controlled, such as the workflow file, its ref, and its repository. A verifier should check these, because they come from outside the build platform.internalParametersare values set by the platform itself, such as the event name and whether the runner was GitHub-hosted.resolvedDependencieslist the concrete inputs that were fetched. For a workflow this includes the source repository with the exact commit digest.
The split between external and internal parameters is deliberate. SLSA treats external parameters as untrusted input that must be complete, so that a consumer can see everything a requester could influence.
runDetails: what happened
runDetails describes the execution.
builder.ididentifies the build platform or workflow that ran. For the action used in this tutorial, it names the workflow file and ref.metadata.invocationIdpoints to the specific workflow run. You can open that URL and read the logs.
The DSSE envelope
The statement is not signed directly as raw JSON. It is placed in a DSSE (Dead Simple Signing Envelope). DSSE has three parts: the base64-encoded payload, a payloadType string, and a list of signatures. The signature covers the payload together with the payload type. This avoids a class of attacks where the same bytes are interpreted as a different kind of message.
{
"payloadType": "application/vnd.in-toto+json",
"payload": "eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjEiLCAuLi59",
"signatures": [
{ "sig": "MEUCIQ...Zg==" }
]
}In GitHub's format, the envelope sits inside a Sigstore bundle, which also carries the signing certificate and a transparency log entry. The next chapters cover how these are produced. For now, note that the bundle is a self-contained file: a consumer can verify it offline against trusted roots, without calling the producer.
Inspecting a real attestation
You can read the statement for your own artifact. The following command downloads the attestation, verifies it, and prints the result as JSON. It uses the flags from the verification examples in this tutorial.
gh attestation verify dist/app --repo OWNER/REPO --format jsonThe output contains the verification result, and the statement is nested inside it. To pull out the decoded predicate, pipe the output to jq:
gh attestation verify dist/app --repo OWNER/REPO --format json \
| jq '.[0].verificationResult.statement.predicate'The path to the statement can differ between CLI versions. If the command prints null, run the first form and look through the JSON to find where statement appears.
You can also decode a payload by hand. Given a DSSE envelope saved to envelope.json, this shows the statement it carries:
jq -r '.payload' envelope.json | base64 --decode | jq .What verification actually checks
Knowing the structure explains what each check protects against.
- The artifact digest matches a
subjectdigest. This ties the file to the claim. - The DSSE signature is valid for the payload. This shows the statement was not altered.
- The signing certificate chains to a trusted root and was valid when the signature was made. This identifies who signed.
- The certificate identity and the predicate fields agree with your policy: the right repository, the right workflow, the right ref.
Check 4 is where you decide what to trust. A valid signature alone only proves that some GitHub Actions workflow signed something. It does not prove that the workflow is the one you expected. The flags --repo, --owner and --signer-workflow exist for that reason.
The diagram below shows how the layers nest.
Common errors and edge cases
- Digest mismatch. If anything changes the file after attestation, such as stripping symbols, re-compressing, or signing it with another tool, the digest changes and verification fails. Attest the exact bytes you publish, as the last step.
- Attesting the wrong path.
subject-pathmust point to the final file. Attesting a build directory's intermediate output attests something other than what users download. - Wildcards.
subject-pathaccepts glob patterns, and each matched file becomes a subject. A pattern that is too broad attests files you did not mean to cover. - Trusting
name. Do not decide trust from the subject name. Use the digest and the verified identity. - Reading predicate fields without verifying. The JSON is only trustworthy after signature verification. Never parse a predicate from an unverified file and act on it.
- Mutable inputs.
resolvedDependenciesrecords the commit, but a workflow that downloads tools or packages at build time without pinning them can still pull in unrecorded inputs. The provenance reports what the platform saw, not everything the build script fetched.
Exercise
A consumer downloads a file named tool-linux and finds a verified attestation whose subject is named app with the same SHA-256 digest as the file. Should they accept it as matching, and which predicate fields should they then check against policy?
Show answer
Yes, the match is made by digest, not by name, so the rename does not matter. They should then check the fields that describe origin and build: the source repository and commit in resolvedDependencies, the workflow path and ref in externalParameters, and the builder.id. These confirm the file came from the expected repository and workflow, not merely from some signed workflow.
Exercise
A workflow builds dist/app, then runs a step that strips debug symbols from it, then attests dist/app. A second workflow attests first and strips afterwards. Which one produces a file that passes verification, and why?
Show answer
The first one. The attestation records the digest of the file at attest time. In the second workflow, stripping changes the bytes after the digest was recorded, so the published file's digest no longer matches any subject and verification fails.