Package provenance
| Type | Signed attestation attached to a release |
|---|---|
| Format | SLSA provenance (https://slsa.dev/provenance/v1), an in-toto attestation |
| Signed with | Sigstore, using short-lived certificates |
| Supported by | npm, PyPI, GitHub artifact attestations |
| OWASP Top 10 | A03:2025 |
| Related | Supply chain compromise, SBOM |
A package on a registry is an archive of files, and the files do not show which repository, commit or machine produced them. A version uploaded with a stolen token looks like any other release unless the real releases carry proof of their build. Package provenance is a signed record, made by the build service at the moment of the build, that ties one exact file to the source commit, the workflow and the build platform that produced it.1 The SLSA framework defines it as checkable information on where, when and how an artifact was made.2
The record lets a person installing the package confirm that it came out of the public pipeline named in it, and lets a maintainer notice a release that did not.
What the record holds
The common format is the SLSA provenance predicate, a JSON document wrapped in the in-toto attestation format, a common envelope for signed statements about software. Its subject lists the output files by digest, such as a sha256 hash. builder.id names the build platform that is trusted to run the build and write the record. buildType names the kind of build, and externalParameters holds the inputs a user could choose, such as the repository and the workflow file. The specification treats those inputs as untrusted: they must be recorded, and whoever relies on the record must check them. resolvedDependencies can record, for example, the git commit that a repository address resolved to, and the run details add an invocation id and start and finish times.2
npm shows the same information on a package page. A green check mark next to the version means the release has provenance, and the details list the build environment, a link to the workflow run, the source commit, the workflow file and an entry in a public ledger.3 GitHub's attestations carry the repository, organisation, environment, commit SHA and triggering event, taken from the identity token of the run.4
How the signature is made
No long-lived signing key is involved. The CI/CD job asks its platform for an OpenID Connect token that describes the run. Sigstore's certificate authority checks that token, issues a short-lived signing certificate with the build details written into it, and records the certificate in a transparency log. The log is public and tamper-evident, which gives a way to detect tampering with a package even if the registry itself were compromised.1 A second record, the publish attestation, is written by the registry when an authorised account uploads the package.1
npm accepts provenance only from builds on cloud-hosted runners at GitHub Actions or GitLab CI/CD.1 PyPI accepts attestations signed by GitHub Actions, GitLab CI/CD and Google Cloud, and binds each wheel or source archive to a digest of its contents.5 For private GitHub repositories, GitHub signs with its own Sigstore instance, which keeps no public transparency log.4
Build levels
SLSA grades how hard the record is to fake.6
| Level | Requirement | Protects against |
|---|---|---|
| Build L1 | Provenance exists; it may be unsigned or incomplete and is easy to forge | Mistakes |
| Build L2 | Signed provenance, made by a hosted build platform | Tampering after the build |
| Build L3 | Hardened platform; build runs cannot affect one another | Tampering during the build |
GitHub states that its artifact attestations reach Build L2 on their own, and that running the build in a reusable workflow shared across an organisation can meet Build L3.4
Limits
Provenance gives no guarantee that a package is free of malicious code. It gives a checkable link to the source and build instructions, which a person still has to audit.1 An attestation that nobody verifies brings no security benefit.4 When the linked repository is deleted or made private, npm shows an error that the provenance can no longer be established.3
The Nx release, August 2025
On 26 August 2025 attackers used a GitHub Actions injection to steal the npm publishing token of the Nx project and published malicious versions for four hours. Nx noticed because the new versions had no npm provenance, which showed they had not come from its CI pipeline. Installs went ahead regardless; in the project's words, provenance "doesn't block unsigned packages from being installed". Nx then moved to trusted publishing over OpenID Connect, put each release behind a manual two-factor authentication approval, and added provenance checks to its own tools.7
Publishing with provenance
On npm, trusted publishing adds provenance to every release without further setup.1 With a token, the GitHub Actions job needs permission to request an identity token, a GitHub-hosted runner and the --provenance flag, with npm CLI 9.5.0 or later and a repository field in package.json that matches the publishing repository exactly:1
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
# checkout, setup-node and npm ci here
- run: npm publish --provenance --access publicTools that do not call npm publish can set NPM_CONFIG_PROVENANCE=true, "publishConfig": { "provenance": true } or provenance=true in .npmrc. npm's own example turns off the package manager cache for release builds.1 On PyPI, the official pypa/gh-action-pypi-publish action uploads attestations by default.8 For a binary, the actions/attest action signs the file named in subject-path, given the id-token: write and attestations: write permissions; for a container image it takes subject-name.9
Checking provenance
npm audit signatures checks the registry signatures and attestations of every installed package and fails on a missing or invalid one.3 In npm's example output, all 1,267 installed packages have registry signatures and 74 of them have attestations.1 Since pnpm 10.21, trustPolicy: no-downgrade stops an install when a new version of a package has weaker trust evidence than earlier ones, such as a token upload after releases made by a trusted publisher.10 The malicious Nx versions had no provenance, unlike the releases Nx built in its pipeline. trustPolicyExclude lets named packages through, and trustPolicyIgnoreAfter skips old releases.11 A file signed with GitHub attestations is checked with gh attestation verify FILE -R owner/repo.9
Prompt for a coding agent
If this repository publishes a package to npm or PyPI, check the release workflow. For npm, make sure the publish job runs on a GitHub-hosted runner, has permissions contents: read and id-token: write, and publishes with provenance (trusted publishing, or npm publish --provenance), and that package.json has a repository field matching this repository exactly. For PyPI, make sure it uses pypa/gh-action-pypi-publish with trusted publishing. If the project installs with pnpm 10.21 or later, add trustPolicy: no-downgrade to pnpm-workspace.yaml. Run npm audit signatures and report any package with a missing or invalid signature. List each file you changed.
See also
- Software supply chain compromise
- Malicious packages
- Dependency confusion and typosquatting
- Package install scripts
- Lockfile
- Pinning to commit hashes
- Secret exposure in CI/CD workflows
- Software bill of materials
- Category: Software supply chain
References
- a b c d e f g h i npm (last edited 4 May 2026). "Generating provenance statements". npm Docs. GitHub.
- a b SLSA. "Provenance". SLSA specification, version 1.2. OpenSSF.
- a b c npm (last edited 7 July 2025). "Viewing package provenance". npm Docs. GitHub.
- a b c d GitHub. "Artifact attestations". GitHub Docs.
- back Python Software Foundation. "Introduction to Attestations". PyPI User Documentation.
- back SLSA. "Build track basics". SLSA specification, version 1.2. OpenSSF.
- back Strumpflohner, Juri (5 September 2025). "S1ngularity: What Happened, How We Responded, What We Learned". Nx blog.
- back Python Software Foundation. "Producing attestations". PyPI User Documentation.
- a b GitHub. "Using artifact attestations to establish provenance for builds". GitHub Docs.
- back pnpm. "pnpm 10.21". pnpm blog.
- back pnpm. "Mitigating supply chain attacks". pnpm documentation.
External links
- SLSA specification, version 1.2, OpenSSF
- Attestations, PyPI User Documentation