Publish via npm Trusted Publishing (OIDC), drop stored token - #116
Merged
Conversation
The Release workflow authenticated with a long-lived NPM_TOKEN secret and 2FA-bypass token — the pattern npm now warns against (a leaked token can publish arbitrary versions). Switch to Trusted Publishing (OIDC): GitHub Actions proves its identity to npm directly, so there is no secret to store, rotate, or leak. - Drop the NODE_AUTH_TOKEN env (no token needed). - Drop --provenance: Trusted Publishing attaches provenance automatically. - Add `npm install -g npm@latest`: OIDC publishing needs npm >= 11.5.1, but Node 22 ships npm 10. - id-token: write was already present. Requires a one-time npm-side setup: configure the hipthrusts package's Trusted Publisher to trust this repo's release.yml workflow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HoGnocn8JV1iaXxdnwA5ir
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.
What does this PR do?
Switches the Release workflow from a long-lived
NPM_TOKENsecret to npm Trusted Publishing (OIDC) — the approach npm recommends for CI/CD, and the reason the 1.1.0 publish failed withENEEDAUTH(no valid token was configured).With Trusted Publishing there is no token to store, rotate, or leak: GitHub Actions presents a short-lived OIDC identity that npm verifies against a publisher you register on the package.
Changes to
release.ymlNODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}env — no token needed.--provenance— Trusted Publishing attaches provenance automatically.npm install -g npm@latest— OIDC publishing requires npm ≥ 11.5.1, but the pinned Node 22 ships npm 10.permissions.id-token: writewas already present (nothing to add).Required one-time setup (npm side, admin)
On npmjs.com → the
hipthrustspackage → Settings → Trusted Publisher, add a GitHub Actions publisher:trycatchalhipthrustsrelease.ymlReleasing 1.1.0 after this merges
The existing
v1.1.0tag points at a commit that still has the old workflow (tag-triggered runs use the workflow file as it existed at the tagged commit). So after merging this and configuring the npm publisher, move the tag to include the fix:Nothing was published on the failed run, so
1.1.0is still free to claim.🤖 Generated with Claude Code
https://claude.ai/code/session_01HoGnocn8JV1iaXxdnwA5ir
Generated by Claude Code