Fail CI when dependencies in your lockfile lose npm provenance or trusted publisher status
danielroe/provenance-actionFail CI when dependencies in your lockfile lose npm provenance or trusted publisher status.
[!WARNING]
This action is under active development and is only one tool to assist in securing your dependencies.
[!NOTE]
undefinedpnpm users: As of pnpm v10.21, pnpm now has built-in support fortrustPolicyin.npmrc, which provides native enforcement of provenance checks. If you’re using pnpm v10.21 or later, you may not need this action. See the pnpm documentation for more details.
pnpm-lock.yaml, package-lock.json, yarn.lock (v1 and v2+), bun.lock👉 See it in action: danielroe/provenance-action-test
name: ci
on:
pull_request:
branches:
- main
paths:
# Trigger a run only on PRs that change the lockfile
# (keep whichever is relevant and/or configure its path):
- pnpm-lock.yaml
- package-lock.json
- yarn.lock
- bun.lock
permissions:
contents: read
jobs:
check-provenance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check provenance downgrades
uses: danielroe/provenance-action@main
id: check
with:
fail-on-provenance-change: true # optional, default: false
# lockfile: pnpm-lock.yaml # optional
# base-ref: origin/main # optional, default: origin/main
# fail-on-downgrade: true # optional, default: true
- name: Print result
run: "echo 'Downgraded: ${{ steps.check.outputs.downgraded }}'"
lockfile (optional): Path to the lockfile. Auto-detected if omitted.workspace-path (optional): Path to workspace root. Default: .base-ref (optional): Git ref to compare against. Default: origin/main.fail-on-downgrade (optional): Controls failure behavior. Accepts true, false, any, or only-provenance-loss. Default: true (which is the same as any).fail-on-provenance-change (optional): When true, fail on provenance repository/branch changes. Default: false.downgraded: JSON array of { name, from, to, downgradeType } for detected downgrades. downgradeType is provenance or trusted_publisher.changed: JSON array of provenance change events { name, from, to, type, previousRepository?, newRepository?, previousBranch?, newBranch? }.name@version.dist.attestations.owner/repo and branch from attestations and warns when they differ (repo changed or branch changed).Trusted publishing links a package back to its source repo and build workflow, providing strong provenance guarantees. It helps ensure the package you install corresponds to audited source and CI.
However, maintainers can still be phished or coerced into publishing without trusted publishing enabled, or switching to a non‑trusted path. In those cases, packages may still carry attestations, but the chain back to the trusted publisher can be weakened.
This action:
This is a stopgap until package managers enforce stronger policies natively. Until then, it offers a lightweight guardrail in CI.
bun.lockb is not supported. (You can generate a bun.lock with bun install --save-text-lockfile.)We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.