Skip to content

Build provenance

proposed checked A convention of ontrack-engineering 0.6.0. How ontrack ruled on it.

Traits to rule on
traits:
supply_chain:
build_level:

Status

Proposed

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.

Context

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.

Decision

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/*

Everything below disappears when you rule, from this sentence up to the Consequences heading, which stays.

How to rule: five steps, all in this file. Read all of them before doing any, because the last one deletes the other four, and do them in one commit.

  1. Write the value of the key under traits: in the frontmatter, as a bare number (2, not "2"), or, if you rule rejected, remove the whole traits: block.
  2. Change status: from proposed to accepted or rejected.
  3. Fill date: and authors:: date: as YYYY-MM-DD, the day you rule; authors:, the names of the people who decided, without email addresses.
  4. Rewrite the Positive, Negative and Neutral lists under Consequences for your verdict: what it makes easier, and what it costs.
  5. Last, delete this block, from its first sentence up to the Consequences heading, which stays. In its place, write the reason for your decision wherever you depart from the recommendation, or, if you adopt it as is, one line that says so.

The first step is the one people forget: a decision written only in prose leaves an agent guessing. This is what the frontmatter looks like once filled, and it is the one part of the file an agent reads without interpreting it:

---
adr: ADR-0021
slug: build-provenance
title: Build provenance
status: accepted
revision: 1
date: 2026-11-14
authors: [Your Name]
supersedes: []
check: npx --no-install ontrack-engineering-check ADR-0021
traits:
supply_chain:
build_level: 2
---

The check: line stays. Once this ADR is accepted, ontrack check runs it from your repository’s root. It reads the keys you ruled and checks only that the files they imply are committed, not what those files say:

  • supply_chain.build_level: with 1, 2 or 3, a workflow holds actions/attest-build-provenance, --provenance or pypa/gh-action-pypi-publish. It does not tell the levels apart.

Any other value has nothing to check, and passes.

The Alternatives Considered below were weighed by governance without knowing your context. Weighing them against yours is still to do, and it is what makes a decision different from an accepted default.

Consequences

Positive

  • A consumer can tell which commit and which workflow produced what they install, and refuse what no workflow explains.
  • A token leaked from a workstation can no longer publish a package that passes for a release.
  • An agent setting up a release knows what to add to the workflow.

Negative

  • The publishing workflow gains 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.
  • A private repository on GitHub Free, Pro or Team cannot use npm provenance or GitHub artifact attestations: level 2 there takes a public repository or GitHub Enterprise Cloud.

Neutral

  • Attestations live on GitHub or in the registry, outside the repository.

Alternatives Considered

0

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.

1

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.

2

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

3

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.

References

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.