Skip to content

Build provenance

accepted ADR-0021 engineering/ADR-0021-build-provenance

Decided traits
supply_chain:
build_level: 2

Accepted

What is this file? A question governance asks your repository, with the answer it recommends. While it says status: proposed, you may edit it freely. revision: dates the question, not the file: you do not fill it, and it only moves when the question changes. rejected is a full answer: when the question does not apply here, rule rejected, remove the whole traits: block, and say what stands in for it. ADR-0001 explains the mechanics.

Someone who installs what this repository publishes reads its source and trusts that the package was built from it. Nothing lets them check. The version, the tag and the changelog (ADR-0012) say what was released, not which commit and which workflow produced the file in the registry. A token stolen from a laptop can publish a package no commit explains.

While this key is empty, an agent setting up a release does not know whether to attach a provenance, or of what strength.

SLSA’s Build track gives the strength a name. Its levels, in v1.1:

Level What it requires What it defends against
0 nothing nothing
1 a provenance exists, describing how the artifact was built mistakes, missing records
2 the provenance is signed, and generated by a hosted build platform tampering after the build
3 the hosted platform is hardened: runs are isolated, the signing material is out of the build steps’ reach tampering during the build

A provenance is a claim, not a proof. It is worth what its verification is worth. A signed provenance nobody checks protects exactly as much as no provenance.

Not concerned: the provenance of what this repository installs (that is ADR-0020’s admission rule), SBOMs (ADR-0019), commit and tag signing, reproducible builds.

What governance fixes, whatever you rule:

  1. The key applies to every repository whose artifacts leave it: when ADR-0012’s delivery.target is package or container, whatever delivery.release_tool says. A repository that releases by hand (manual) is the case this ADR exists for, not an exception to it. A repository that publishes nothing (platform or none) produces no provenance: it rules this ADR rejected.
  2. An unverified provenance proves nothing. Whoever consumes the artifact verifies it: npm audit signatures for npm packages, gh attestation verify <file> -R <owner>/<repo> for an artifact attested on GitHub (oci://<image> for a container image). For Python, no installer verifies PEP 740 attestations: pypi-attestations verify pypi is a separate, manual step. ADR-0020’s admission rule reports a dependency’s provenance when it is added.
  3. The provenance is produced by the workflow that publishes, under ADR-0011’s rules: actions pinned by SHA (rule 3), permissions: declared and limited to what signing needs. Never by hand, never from a workstation.

What is yours to decide is the level.

What governance recommends, and why.

Key Recommended value Reason
supply_chain.build_level 2 on GitHub-hosted runners the platform signs with a short-lived certificate bound to the workflow’s identity, with no key to manage. It has a precondition: npm provenance needs a public source repository, and GitHub artifact attestations on a private or internal repository need GitHub Enterprise Cloud (on Free, Pro and Team, public repositories only). A private repository on those plans cannot reach 2 through them

What 2 looks like in practice. The mechanism follows from where you publish:

Where you publish How Permissions it needs
a GitHub release, a binary, a container image actions/attest-build-provenance after the build step id-token: write, attestations: write
npm npm publish --provenance, or trusted publishing, which adds it id-token: write
PyPI Trusted Publishing with pypa/gh-action-pypi-publish, which uploads PEP 740 attestations by default id-token: write

For an artifact attested on GitHub:

# in the publishing job of .github/workflows/release.yml
permissions:
contents: read
id-token: write
attestations: write
steps:
# ... checkout and build, pinned by SHA ...
- uses: actions/attest-build-provenance@<sha> # vX.Y.Z
with:
subject-path: dist/*

The recommendation is adopted as is. This repository publishes a package (ADR-0012), so the key applies, and it is public, which is what level 2 needs on npm. The publish job of .github/workflows/release.yml already publishes from the workflow, by trusted publishing, with id-token: write confined to that job and its actions pinned by SHA. The GitHub release carries no built file, so nothing is attested there.

npm publish now passes --provenance explicitly. The version on the registry when this was ruled, 0.3.0, carries registry signatures and no provenance attestation: the next release is the first that can show one.

  • Someone who installs ontrack from npm can tell which commit and which workflow produced it, with npm audit signatures.
  • A token leaked from a workstation cannot publish a package that passes for a release: no token is stored, and the provenance names the workflow.
  • An agent touching the release workflow knows the flag is a decision, not a leftover.
  • The publish job keeps id-token: write, a permission to keep confined to that job.
  • Level 2 does not protect against a step that tampers with the build from inside the workflow.
  • The protection exists only where someone verifies, and 0.3.0 has nothing to verify.
  • The check only sees that a workflow holds --provenance. Whether a release carries an attestation is read on the registry, after it.
  • The attestation lives in the npm registry, outside the repository.
  • Level 3 was not taken: it restructures the release around a hardened reusable workflow, and no threat identified for this package asks for it.

No provenance. Nothing to maintain; nothing for a consumer to check either. A legitimate answer only for a repository whose consumers never install the artifact from a registry.

A provenance file, unsigned or signed with a key the repository manages. It records how the build ran, but anyone who can publish can also write it. Costs nearly as much as 2 on a hosted runner, for less.

Recommended. Signed by the platform, no key to manage. Does not isolate the build from its own steps.

The build runs on a hardened platform: on GitHub, a reusable workflow that isolates the build from the calling workflow, or slsa-github-generator’s builders and generators. It defends against a compromised step tampering with the artifact during the build. The cost: the release workflow is restructured around a reusable workflow, follows that generator’s releases and constraints, and is harder to debug. Worth it when the repository’s consumers model a compromised build step as a threat.

The key.

Key What it holds Allowed values
supply_chain.build_level the SLSA Build level the repository’s published artifacts reach 0, 1, 2, 3

What the check does not see. It refuses an empty or unknown value. It reads neither the workflows nor ADR-0012: build_level: 2 in a repository whose release workflow attests nothing passes it, and review catches it.

An empty key is not an answer. The value is written in this file and nowhere else; whoever needs it links here. See ADR-0001 for the check command.