fix(ci): verify the provenance attestation landed after publishing - #596
Open
yzxcj797 wants to merge 1 commit into
Open
fix(ci): verify the provenance attestation landed after publishing#596yzxcj797 wants to merge 1 commit into
yzxcj797 wants to merge 1 commit into
Conversation
npm publish --provenance publishes cleanly WITHOUT an attestation whenever the run's OIDC token does not satisfy npm's requirements — a silent trust downgrade for attestation-checking installers, which is how 0.1.5 shipped with no evidence after 0.1.0 had one (yc-software#591). After publishing, query the registry for the version's attestations and fail the job when none exist, turning the next silent downgrade into a loud CI failure naming the likely cause. The check runs on the already-published keep-path too, so an early-exit that skips publishing still validates the version's evidence.
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.
Summary
Addresses #591 — prevents the silent trust-downgrade class of failure that produced 0.1.5.
Root cause (per the analysis on the issue)
npm publish --provenancepublishes cleanly without an attestation whenever the run's OIDC token doesn't satisfy npm's requirements (wrong event/ref for the token, permission hiccup, manual correction run). No error surfaces — the version simply lands with no trust evidence, and attestation-checking installers (aubetrust check, pnpm trust policies) then see a downgrade versus any earlier version that had one. That's exactly the 0.1.5 shape: 0.1.0 had an attestation, 0.1.5 (published through the version-correction run) had none.Fix
The publish job now verifies the attestation landed, instead of trusting the flag:
Notes
trustPolicyExcludeworkaround stands. This change protects every future release.npm view <pkg> attestationsreturnsnullfor no evidence on supported npm versions; the check treatsnull,[], and empty as failure.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.