Sub topic 1
Why build provenance matters: threats between source and artifact
When you install a binary or pull a container image, you trust a chain of steps you can't see. Someone wrote code, a system compiled it, someone uploaded the result, and your tooling downloaded it. This chapter maps the places where that chain can break. It also explains what build provenance is, and why a hash or an ordinary signature doesn't close the gap.
Prerequisites
This chapter assumes you already have the following:
- Basic GitHub Actions knowledge: jobs, steps, and the
permissionsblock. - Command-line use of
gitand the GitHub CLI. - Experience building and publishing a binary or container image.
- A basic idea of what a hash and a digital signature are.
You don't need any knowledge of SLSA, Sigstore, or in-toto. Later chapters introduce them one at a time.
The gap between source and artifact
Most developers review source code. Most users run artifacts. An artifact is the file that actually gets deployed: a binary, a package, an archive, or a container image. Between the two sits a series of transformations:
- A developer changes the source and a repository accepts the change.
- A build system fetches the source and dependencies, and runs build steps.
- The build output is uploaded to a registry or release page.
- A consumer downloads it and runs it.
A reviewer can read the source and still have no idea whether the artifact was built from that source. Nothing in a bare binary tells you which commit it came from, which machine built it, or who touched it afterward. Closing that gap is the purpose of build provenance.
Threats at each stage
The SLSA project catalogs supply chain threats by the stage where they occur. The grouping below follows the same idea, with real incidents as anchors.
Source threats
An attacker can get bad code into the repository in a few ways.
- Unauthorized change. A contributor with write access, or a stolen account, pushes malicious code. If branch protection and review are missing, nothing stops it.
- Trusted-maintainer takeover. In 2018 the
event-streamnpm package passed to a new maintainer who then added a malicious dependency targeting a specific wallet application. The change came through a legitimate channel. - Compromised upstream repository. If your project depends on code from another repository, an attacker can target that repository instead of yours.
Provenance doesn't prevent these. A perfectly signed build of malicious source is still a malicious build. Source controls such as required reviews and protected branches handle this stage. Provenance can at least tell a consumer which commit was built, so a bad commit can be traced.
Build threats
Here the source is fine, and the attacker wins by changing what happens next.
- Build from the wrong source. The build is run on a fork, an unreviewed branch, or a modified checkout, and the output is published as if it came from the official repository.
- Compromised build platform. In the 2020 SolarWinds incident, attackers had access to the build environment and injected malicious code during compilation. The source repository was clean. The artifact was not.
- Stolen build or signing secrets. If a long-lived token or signing key sits in CI configuration, anyone who reads it can produce artifacts that look official.
- Parameter injection. A build that accepts external inputs, such as a workflow input or a branch name interpolated into a shell command, can be steered into doing something the maintainers didn't intend.
- Poisoned build steps. The build pulls in an action, script, or tool that has itself been tampered with. In March 2025 the popular
tj-actions/changed-filesGitHub Action was modified so that workflows using it printed their secrets into logs. Version tags were repointed to the malicious commit, so even workflows that "pinned" a tag were affected.
Dependency threats
Your build consumes other people's artifacts. A compromised dependency becomes part of your artifact, and your provenance will faithfully say you built it. Provenance for your own output doesn't vouch for your inputs. This is a limit of the technique, covered again in the last chapter.
Distribution threats
After a clean build, the artifact can still be altered on its way to users.
- Replaced upload. An attacker with access to the storage bucket or release page swaps the file. In the 2021 Codecov incident, attackers modified the company's Bash Uploader script on its hosting, and it ran in customers' CI pipelines for weeks.
- Registry compromise. The package registry itself is attacked, or a maintainer's registry account is.
- Unreproducible release archives. In the 2024
xzbackdoor, the release tarballs contained a build script that was not present in the git repository. Anyone who reviewed the repository would not have seen it. Someone had to compare the tarball to the source to notice.
Consumption threats
The consumer can also pick the wrong thing. Typosquatted package names and look-alike image names rely on a user installing something plausible but unofficial. A consumer with no way to ask "was this built by the project I think it is?" has little defense.
Why a checksum is not enough
A common first defense is to publish a checksum next to the download.
# Publisher side
sha256sum dist/app > dist/app.sha256
# Consumer side
curl -LO https://example.com/releases/app
curl -LO https://example.com/releases/app.sha256
sha256sum --check app.sha256This catches accidental corruption. It does not catch an attacker. If someone can replace app on the server, they can replace app.sha256 too, and the check passes. Even when the checksum is delivered separately, it only says "this file has this hash". It says nothing about who produced the file or how.
A traditional detached signature, such as one made with a maintainer's GPG key, is better. It ties the file to a key. But it brings new problems:
- The key is long-lived and someone must store it. Often it lives in CI secrets or on a laptop, where it can leak.
- Consumers must learn the right public key and trust it. Key rotation and revocation are hard to do well.
- The signature says "the holder of this key signed this file". It says nothing about what the file was built from. A stolen key signs anything.
Both approaches answer "has this file changed since publication?" at best. Neither answers the question consumers actually care about: was this artifact produced from the expected source by the expected build process?
What build provenance is
Provenance is a record of where an artifact came from. Build provenance is that record for a build: which inputs went in, which process ran, and what came out. An attestation is a signed statement of that kind, made by a party you can identify and bound to a specific artifact through its digest. A digest is the cryptographic hash of the artifact's bytes, for example its SHA-256.
A build provenance attestation for a GitHub Actions build typically records:
- The artifact digest it describes (the "subject").
- The repository and the commit the build ran on.
- The workflow file that performed the build, and the ref that triggered it.
- The kind of runner, and which GitHub-hosted infrastructure was used.
- A signature that proves the statement came from that workflow run, not from someone claiming to be it.
The anatomy is covered in detail in a later chapter. For now, note what changes for the consumer. Instead of asking "does this hash match what the website says?", the consumer can ask "does this file have a valid signed statement saying it was built by workflow build.yml in OWNER/REPO?" The second question is much harder for an attacker to fake, because they would have to run code inside that workflow.
Which threats provenance addresses
Provenance doesn't fix every threat above. The table shows where it helps, and where other controls are needed.
| Threat | Does provenance help? | What else is needed |
|---|---|---|
| Malicious commit merged to the repository | Partly. It identifies the commit built. | Branch protection, code review |
| Artifact built on a fork or unreviewed branch | Yes. The attestation names the repo and ref. | A consumer policy that checks them |
| File swapped on the release page or registry | Yes. The digest no longer matches any valid attestation. | Consumers must actually verify |
| Stolen long-lived signing key | Largely avoided. No long-lived key is needed for keyless signing. | Short-lived credentials (later chapters) |
| Compromised build platform | Partly. It depends on how isolated the build is. | Hardened builders (see the SLSA levels chapter) |
| Compromised dependency | No. | Dependency pinning, SBOMs, scanning |
| Typosquatted name | Partly. The consumer can require a specific repo. | Policy that names the expected source |
The pattern is that provenance is strongest between the build and the consumer. It turns "trust the download location" into "trust a specific, named build process".
What you need from a provenance system
The threats above lead to a few requirements. These drive the design choices in the rest of the tutorial.
- Bound to the artifact. The statement must name the artifact by digest, so it can't be reused for a different file.
- Produced by the build, not by a person. The identity behind the signature should be the workflow run itself, so a human with a stolen password can't impersonate it.
- No long-lived secrets. Credentials that live for months leak. Credentials that live for minutes are far less useful to an attacker.
- Publicly checkable. A consumer must be able to verify without asking the publisher to confirm.
- Specific enough to enforce. The statement should carry enough detail (repository, workflow, ref) for a consumer to write a rule against it.
GitHub's artifact attestations meet these by combining three things. SLSA gives the vocabulary and levels for how trustworthy a build is. In-toto gives the statement format. Sigstore, together with GitHub Actions OIDC identities, gives keyless signing. Each gets its own chapter.
Exercises
Exercise
A project publishes app and app.sha256 on the same release page. An attacker gains write access to the release page. Explain why sha256sum --check does not protect consumers, and name the question that provenance lets the consumer ask instead.
Show answer
The attacker can replace both files, so the new hash matches the new file and the check passes. The check only proves the file matches a hash that the same untrusted location supplied. With provenance, the consumer asks whether the file's digest appears in a signed statement showing it was built by a specific workflow in a specific repository. The attacker can't produce that statement without running code inside that workflow.
Exercise
In the SolarWinds-style attack, the source repository was clean but the build output was malicious. Would a valid provenance attestation from the compromised build have helped the consumer by itself? Explain in two or three sentences.
Show answer
Not by itself. If the build platform is compromised, the attacker can make it produce a valid-looking attestation for the malicious output. Provenance is only as trustworthy as the build platform that creates it. This is why SLSA defines build levels that require the signing to be isolated from the build steps, which a later chapter covers.
Exercise
Match each threat to the stage where it occurs: (a) a typosquatted package name, (b) a release file replaced after the build, (c) a pull request with malicious code is merged, (d) a build runs on an unreviewed fork.
Show answer
(a) consumption, (b) distribution, (c) source, (d) build.