Repository navigation
feat(ci): add provenance attestations and SHA256 digests to publish workflows - #612
Open
SceptredHead wants to merge 1 commit into
Open
SceptredHead wants to merge 1 commit into
SceptredHead wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)id-token: writepermission so the job can obtain an OIDC token for the npm registry.npm publishtonpm publish --provenance. The registry stores a signed attestation linking the package to this exact workflow run. Consumers can verify withnpm audit signatures grat-server.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_TOKENstill uses theNPM_TOKENsecret; npmjs.com does not yet support fully OIDC-linked publishing without a long-lived token, but the--provenanceflag is the OIDC-signed layer that matters for supply-chain verification.Crate SHA256 digests (
.github/workflows/publish-crates.yml)id-token: writepermission (future-proofing for when crates.io ships trusted publishing).contents: writeso the job can attach files to the GitHub release.scripts/verify-crate-published.sh, acargo package --no-verifystep produces the same.cratearchive and records its SHA256 digest.crate-sha256sums.txtand uploaded to the GitHub release as an asset viagh release upload, so the file appears on the release page alongside the source tarballs.CARGO_REGISTRY_TOKENremains in use; the OIDC path will replace it once crates.io completes its trusted-publishing rollout.Closes #409