Skip to content

feat(ci): add provenance attestations and SHA256 digests to publish workflows - #612

Open
SceptredHead wants to merge 1 commit into
DevNiola:mainfrom
SceptredHead:feat/409-npm-crate-provenance
Open

SceptredHead wants to merge 1 commit into
DevNiola:mainfrom
SceptredHead:feat/409-npm-crate-provenance

Conversation

@SceptredHead

Copy link
Copy Markdown

Description

The publish workflows had no provenance or integrity verification, so consumers could not confirm that a published artifact was built directly from this repository. This PR adds OIDC-linked npm provenance and SHA256 digests for all published crates.

What was implemented

npm provenance (.github/workflows/publish-npm.yml)

  • Added id-token: write permission so the job can obtain an OIDC token for the npm registry.
  • Switched npm publish to npm publish --provenance. The registry stores a signed attestation linking the package to this exact workflow run. Consumers can verify with npm audit signatures grat-server.
  • Added a post-publish step that runs npm pack, computes a SHA256 digest of the tarball, and surfaces it as a workflow notice so it can be quoted in release notes.
  • NODE_AUTH_TOKEN still uses the NPM_TOKEN secret; npmjs.com does not yet support fully OIDC-linked publishing without a long-lived token, but the --provenance flag is the OIDC-signed layer that matters for supply-chain verification.

Crate SHA256 digests (.github/workflows/publish-crates.yml)

  • Added id-token: write permission (future-proofing for when crates.io ships trusted publishing).
  • Added contents: write so the job can attach files to the GitHub release.
  • After each crate is published and verified via scripts/verify-crate-published.sh, a cargo package --no-verify step produces the same .crate archive and records its SHA256 digest.
  • All three digests are concatenated into crate-sha256sums.txt and uploaded to the GitHub release as an asset via gh release upload, so the file appears on the release page alongside the source tarballs.
  • CARGO_REGISTRY_TOKEN remains in use; the OIDC path will replace it once crates.io completes its trusted-publishing rollout.

Closes #409

…orkflows

Consumers of published packages currently have no way to verify that an
artifact was built from this repository rather than modified post-build.

npm provenance (publish-npm.yml):
- Added id-token: write permission so GitHub Actions can obtain an OIDC
  token for the npm registry.
- Switched to npm publish --provenance; this signs the package with an
  OIDC-linked attestation stored on the registry. Consumers can verify
  with: npm audit signatures grat-server
- Added a post-publish step that runs npm pack, computes a SHA256 digest,
  and surfaces it as a workflow notice for inclusion in release notes.
- NODE_AUTH_TOKEN still uses the NPM_TOKEN secret; long-lived tokens remain
  necessary until npmjs.com ships full OIDC-linked publishing support.

Crate provenance (publish-crates.yml):
- Added id-token: write permission (future-proofing for crates.io OIDC).
- Added contents: write so the job can attach the digest file to the release.
- After each crate is published and verified, cargo package --no-verify
  produces the same .crate archive and sha256sum records its digest.
- All three digests are concatenated into crate-sha256sums.txt and attached
  to the GitHub release via gh release upload so the file appears on the
  release page for downstream verification.
- CARGO_REGISTRY_TOKEN is still required; the OIDC path will replace it
  once crates.io completes its trusted publishing rollout.

Closes DevNiola#409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevOps] Add provenance (SLSA) to npm and crate publishing workflows

1 participant