Skip to content

ci: stage npm releases for 2FA approval - #39

Merged
IBJunior merged 1 commit into
mainfrom
ci/npm-staged-publishing
Oct 4, 2026
Merged

IBJunior merged 1 commit into
mainfrom
ci/npm-staged-publishing

Conversation

@IBJunior

@IBJunior IBJunior commented Oct 4, 2026

Copy link
Copy Markdown
Member

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; direct npm publish is an opt-in that npm labels "Not recommended".

Rather than tick it, this moves the workflow to staged publishing:

  • CI runs npm stage publish --access public. The version is uploaded but stays private.
  • A maintainer approves it on npmjs.com (Staged Packages → Approve) or with 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:

  • The npm floor comment now says ≥ 11.15.0 (staged publishing's requirement); the workflow already installs npm@latest.
  • AGENTS.md adds the approval as step 4 of the release flow and records why the publisher is stage-only, so a future 403 isn't "fixed" by enabling direct publish.

After merging

gh workflow run publish.yml -f tag=v0.9.0

Then approve 0.9.0 under Staged Packages on npmjs.com, and delete the NPM_TOKEN secret.

🤖 Generated with Claude Code

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.
@IBJunior
IBJunior merged commit d4e8cfc into main Oct 4, 2026
2 checks passed
@IBJunior
IBJunior deleted the ci/npm-staged-publishing branch October 4, 2026 17:05
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.

1 participant