Repository navigation
ci: stage npm releases for 2FA approval - #39
Merged
Merged
Conversation
npm trusted publishers only allow staged publishing unless "Allow npm publish" is ticked, so the v0.9.0 run failed with 403 OIDC permission denied. Rather than enable direct publishing, which npm recommends against, the workflow now runs npm stage publish: CI uploads the version and a maintainer approves it on npmjs.com with 2FA before it goes live. This CLI runs on users' machines via npx, so a release that a compromised workflow could ship on its own would execute immediately. AGENTS.md documents the approval step and why the publisher is stage-only.
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
The v0.9.0 publish reached npm with a valid OIDC identity (provenance was signed) and was then refused:
403 … OIDC permission denied for this action. New trusted publishers may only stage versions; directnpm publishis an opt-in that npm labels "Not recommended".Rather than tick it, this moves the workflow to staged publishing:
npm stage publish --access public. The version is uploaded but stays private.npm stage approve <stage-id>, with 2FA. Only then does it go live.Why it's worth one extra click per release: this CLI runs on users' machines through
npx. With direct publishing, a compromised workflow or dependency could ship a release that executes immediately. With staging, it can only propose one.Also:
npm@latest.After merging
Then approve 0.9.0 under Staged Packages on npmjs.com, and delete the
NPM_TOKENsecret.🤖 Generated with Claude Code