fix(js): give npm provenance a repository.url to verify against - #293
Merged
Conversation
Trusted publishing (OIDC) makes npm attach a provenance attestation to every publish, and the registry then cross-checks the attestation's source repo against "repository.url" in the manifest. js/package.json carried no repository field at all, so the check compared "link-foundation/links-notation" against "" and rejected the upload: npm error code E422 Error verifying sigstore provenance bundle: Failed to validate repository information: package.json: "repository.url" is "" This is deterministic, which is why re-running the job never helped. It only surfaced now because 0.13.0 and earlier were token publishes, which attach no provenance and so never consulted the field. The repository/bugs/homepage shape is copied from link-foundation/js-ai-driven-development-pipeline-template, which already carries it. Two smaller fixes in the same publish step: - The step piped npm output through "tee publish.log" inside the package directory, so npm built the tarball with the log inside it; 0.15.0's tarball shipped a 0-byte publish.log. The log now goes to RUNNER_TEMP. - The failure handler only explained ENEEDAUTH/E401/E403, so this E422 failed with no diagnostic at all. Added a provenance branch that names the mismatched repository.url. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W35mjrg7zi5Y8TW17EWduq
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.
Problem
publishToNpmhas been failing on every run, including re-runs. The 2FA banner on npmjs.com is unrelated noise — the real error is at the very end of the log in run 33160102741:js/package.jsoncarried norepositoryfield at all. Trusted publishing (OIDC) makes npm attach a sigstore provenance attestation derived from the Actions context, and the registry then cross-checks it againstrepository.urlin the manifest. Empty never matches, so the upload is rejected.Why re-running never helped: it is deterministic, not a flake. The package signs fine — the log shows
Provenance statement published to transparency log— it is the registry's post-verification that fails, every time.Why it used to work: 0.13.0 and earlier were token publishes, which attach no provenance and so never consulted the field. Switching to trusted publishing exposed a long-standing gap rather than creating one. No npm account or token setting needs changing.
Fix
Added
repository/bugs/homepagetojs/package.json, reusing the exact shape fromjs-ai-driven-development-pipeline-template, which already carries it. That repo does not have this bug, so there was nothing to report upstream — the fix flows from the template to here.Two related bugs fixed in the same step
npm publish 2>&1 | tee publish.loginside the package directory, so npm built the tarball with the log in it — the 0.15.0 tarball contents list a 0-bytepublish.log. It now goes to$RUNNER_TEMP.ENEEDAUTH|E401|E403, so this failure printed no hint at the cause. Added a provenance branch that names the mismatchedrepository.url.Verification
npm publish --dry-run --access publicpasses, withrepository.urlcorrect and nopublish.login the tarball.npm view links-notation@0.15.0→ 404), so no version bump is needed; the existing job will publish it once this lands.🤖 Generated with Claude Code
https://claude.ai/code/session_01W35mjrg7zi5Y8TW17EWduq