chore: switch npm publish from token auth to OIDC trusted publishers#75
Closed
chore: switch npm publish from token auth to OIDC trusted publishers#75
Conversation
Replace NPM_TOKEN-based authentication with npm's OIDC trusted publishers. This eliminates the need for a long-lived npm token secret and adds provenance attestation to published packages. Changes: - publish-npm.yml: add id-token:write permission, setup-node with registry-url, remove NPM_TOKEN env - bin/publish-npm: remove npm config set for auth token, switch from yarn publish to npm publish --provenance --access public - bin/check-release-environment: remove NPM_TOKEN check (no longer needed) - release-doctor.yml: remove NPM_TOKEN env Co-authored-by: Cursor <cursoragent@cursor.com>
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
NPM_TOKENsecret-based auth with npm's OIDC trusted publishers (already configured on npmjs.com)npm publish --provenanceNPM_TOKEN/KERNEL_NPM_TOKENsecrets across workflows and scriptsChanges
.github/workflows/publish-npm.ymlpermissions: id-token: write, updatedactions/setup-nodeto v4 withregistry-url, removedNPM_TOKENenvbin/publish-npmnpm config settoken line, switchedyarn publishtonpm publish --provenance --access publicbin/check-release-environmentNPM_TOKENcheck (no secrets needed with OIDC).github/workflows/release-doctor.ymlNPM_TOKENenv from the check stepHow it works
With OIDC trusted publishers, GitHub Actions requests a short-lived OIDC token during the workflow run. npm verifies this token against the trusted publisher configuration (repo + workflow) — no long-lived secrets involved. The
--provenanceflag also attaches a signed build provenance attestation to each published package.Test plan
KERNEL_NPM_TOKEN/NPM_TOKENsecrets from the repo settingsNote
Medium Risk
Changes the release/publishing path and authentication mechanism; failures would block npm releases, and correct OIDC/trusted-publisher configuration is required for successful publishes.
Overview
Publishing to npm is migrated from long-lived
NPM_TOKENsecrets to npm OIDC trusted publishers by grantingid-token: writepermissions inpublish-npm.ymland removing token env wiring from workflows.The publish script drops per-run npm token configuration and switches from
yarn publishtonpm publish --provenance --access public, whilecheck-release-environmentno longer validates presence ofNPM_TOKEN.Written by Cursor Bugbot for commit 24e00ea. This will update automatically on new commits. Configure here.