npm Provenance: What Changed and What It Means for Publishers

In 2023 npm began accepting provenance statements with published packages: signed records, created in CI, that link a specific package version to the source repository and build workflow that produced it. This note explains what changed, what the feature does and does not prove, and what to do if you publish to npm.

What changed

Before provenance, a package page on npm told you who uploaded a version and nothing verifiable about where it came from. The tarball might have been built from the tagged commit on GitHub, or from a laptop with uncommitted changes, and a user had no way to tell. In 2023 npm, together with GitHub and the Sigstore project, introduced an opt-in flag for the publish command. When a package is published from a supported CI system with that flag, the npm CLI generates an attestation describing the build, signs it with a short-lived certificate tied to the CI identity, and records it in Sigstore's public transparency log. The registry stores the attestation with the version and shows a provenance section on the package page.

How you turn it on

In a GitHub Actions workflow, the job needs permission to request an OIDC identity token, and the publish command needs the flag:

permissions:
  contents: read
  id-token: write
steps:
  # (check out the repository first)
  - uses: actions/setup-node@v4
    with:
      node-version: 22
      registry-url: https://registry.npmjs.org
  - run: npm ci
  - run: npm publish --provenance --access public
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

You can also set "publishConfig": { "provenance": true } in package.json so you cannot forget the flag. Provenance requires a reasonably recent npm CLI and a supported cloud CI provider; npm Docs lists the current requirements. Publishing from a local machine cannot produce provenance, by design. (If your setup has moved to tokenless trusted publishing from CI, npm Docs describes how that interacts with provenance.)

What it proves and what it does not

Provenance tells youIt does not tell you
Which repository and commit the build came fromThat the code in that commit is safe
Which workflow file ran the buildThat the workflow itself was not tampered with by someone with write access
That the record is in a public, append-only logAnything about the package's dependencies

It moves the trust question from "do I trust whoever uploaded this?" to "do I trust this repository and its build process?", which is a question you can actually investigate.

What it means for you

For the signing infrastructure behind this, see our Sigstore notes; for the broader idea, the essay on provenance attestations.

Related pages