Inside Provenance: What a Package Attestation Really Proves

"This package has provenance" sounds reassuring, but it is a narrower claim than many people assume. Understanding exactly what is being attested helps you decide whether it is worth setting up, and it helps you read other people's badges with the right amount of trust.

The question provenance answers

A traditional upload proves only that someone with the right credentials pushed a file. It says nothing about where that file came from. A stolen token, a compromised laptop or a maintainer building from an uncommitted working tree all look identical on the registry.

Provenance changes the question from "who uploaded this?" to "which source revision and which build process produced this exact artefact?". An attestation is a signed statement linking the published file's digest to a repository, a commit and a CI workflow run. If the statement verifies, you know the artefact was built by that workflow from that commit, not on somebody's machine.

How the major registries do it

On npm, a package published from a supported CI provider with npm publish --provenance gets an attestation that the npm registry displays on the package page. The workflow needs permission to request an OpenID Connect token, which in GitHub Actions looks like this:

permissions:
  contents: read
  id-token: write
steps:
  # (fetch the repository source first)
  - uses: actions/setup-node@v4
    with:
      registry-url: 'https://registry.npmjs.org'
  - run: npm ci
  - run: npm publish --provenance --access public

PyPI took a related route. Trusted Publishing lets a CI workflow upload without a long-lived API token, and the official publishing action can generate attestations for the uploaded distributions. Both ecosystems lean on Sigstore underneath, which issues short-lived signing certificates bound to the CI identity and records signatures in a public transparency log.

Where SLSA fits

SLSA (Supply-chain Levels for Software Artifacts), maintained under the OpenSSF, is a framework rather than a tool. It describes increasing levels of assurance about how an artefact was built, from simply having provenance at all to having it generated by a hardened, isolated build platform. Registry provenance from a hosted CI runner is a practical step on that ladder. It is useful to read the SLSA specification yourself instead of relying on a badge, because the levels distinguish carefully between what the build platform guarantees and what it merely reports.

What provenance does not tell you

This is the part worth being blunt about. A valid attestation does not mean the code is safe. It means the code is what the named repository and workflow produced. If a malicious commit lands in the repository, or the workflow itself pulls a compromised dependency, the attestation will faithfully certify the bad build.

Is it worth the effort?

For most maintainers, yes, because the cost is low once releases already run in CI, and the benefit is real: a stolen personal token is no longer enough to publish something that looks legitimate, at least to users who check. The bigger win is often the side effect. Moving publishing into an automated workflow removes "it worked on my machine" builds, forces you to pin your release steps, and leaves a clear record of every version you shipped.