Fail 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.
- supports
pnpm-lock.yaml
,package-lock.json
,yarn.lock
(v1 and v2+),bun.lock
- handles transitives by comparing resolved versions
- inline GitHub annotations at the lockfile line
- JSON output and optional hard‑fail (default: on)
- pure TypeScript, Node 24+
👉 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. Acceptstrue
,false
,any
, oronly-provenance-loss
. Default:true
(which is the same asany
).fail-on-provenance-change
(optional): Whentrue
, fail on provenance repository/branch changes. Default:false
.
downgraded
: JSON array of{ name, from, to, downgradeType }
for detected downgrades.downgradeType
isprovenance
ortrusted_publisher
.changed
: JSON array of provenance change events{ name, from, to, type, previousRepository?, newRepository?, previousBranch?, newBranch? }
.
- Diffs your lockfile against the base ref and collects changed resolved versions (including transitives).
- Checks npm provenance via the attestations API for each
name@version
. - Falls back to version metadata for
dist.attestations
. - Emits file+line annotations in the lockfile.
- If provenance exists for both the previous and new version, extracts GitHub
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:
- Detects when a dependency update loses npm provenance (no attestations) or loses trusted publisher (attestations but no trusted publisher marker), and
- Fails CI by default (configurable), before that change lands in your main branch.
This is a stopgap until package managers enforce stronger policies natively. Until then, it offers a lightweight guardrail in CI.
- Runs on Node 24+ and executes the TypeScript entrypoint directly.
bun.lockb
is not supported. (You can generate abun.lock
withbun install --save-text-lockfile
.)- Repository and branch change detection is best‑effort; attestation shapes vary and some packages omit repo/ref details.