Skip to content

fix(ci): strip stale _authToken so OIDC Trusted Publisher actually fires on Release#6

Merged
chrischall merged 1 commit into
mainfrom
fix/release-oidc-no-stale-npm-token
May 21, 2026
Merged

fix(ci): strip stale _authToken so OIDC Trusted Publisher actually fires on Release#6
chrischall merged 1 commit into
mainfrom
fix/release-oidc-no-stale-npm-token

Conversation

@chrischall
Copy link
Copy Markdown
Owner

Summary

Strip _authToken from the .npmrc that setup-node generates, so npm publish --provenance has no stale placeholder static-token to try before falling through to OIDC. Trusted Publisher is correctly configured on the npm side — this just removes the foot-gun in the workflow.

Why

Every release run since Trusted Publisher was set up has failed with:

npm error code E404
npm error 404 Not Found - PUT https://registry.npmjs.org/@fetchproxy%2fprotocol - Not found
npm error 404  '@fetchproxy/protocol@0.4.1' is not in this registry.

Diagnostic readout from the failed run:

release  Publish @fetchproxy/protocol to npm  env:
                                              NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX

XXXXX-XXXXX-XXXXX-XXXXX is GitHub Actions' masked rendering of an empty masked value. We don't pass NPM_TOKEN (the whole point is OIDC), so NODE_AUTH_TOKEN is empty — but setup-node already wrote //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} into .npmrc, which npm picks up as "the user has a static token to use." It tries that placeholder before OIDC, the registry rejects, and the privacy-preserving 404 hides the actual failure mode.

Notable: the provenance / sigstore step worked (Provenance statement published to transparency log: ...) — which means OIDC IS reachable. npm just never tries it for the actual PUT, because the static token is "available."

Fix

Add a second sed to the cleanup step that already strips always-auth:

sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"

Then dump the final .npmrc to the log so future debugging has a record of what npm actually sees.

Test plan

  • After merge, re-trigger Tag & Bump (bumps to 0.4.3) and watch Release succeed without 404
  • No real-token-based release path is broken — we don't have an NPM_TOKEN secret defined for this repo

🤖 Generated with Claude Code

… fires

Symptom: every `npm publish --provenance` step in the Release workflow
fails with `npm error 404 Not Found - PUT registry.npmjs.org/...`, even
though npm Trusted Publisher is correctly configured for @fetchproxy/*.

Cause: `setup-node` with `registry-url:` writes a .npmrc that says
`//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`. We don't pass
NPM_TOKEN as a secret (the whole point is OIDC), so GitHub Actions
expands NODE_AUTH_TOKEN to the masked placeholder
`XXXXX-XXXXX-XXXXX-XXXXX`. npm picks up the placeholder as a static
auth token, tries it against the registry first, gets rejected, and
returns a privacy-preserving 404 instead of falling through to OIDC.

Fix: strip the `_authToken` line (in addition to the existing
`always-auth` strip) before `npm publish`. With no static auth in
.npmrc, npm publish takes the OIDC path that Trusted Publisher
expects, and provenance + publish both succeed.

Dump the final .npmrc to the log so future debugging has a record
of what npm actually sees.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chrischall chrischall added the bug Something isn't working label May 21, 2026
@chrischall chrischall enabled auto-merge May 21, 2026 19:51
@chrischall chrischall merged commit f25687a into main May 21, 2026
2 checks passed
@chrischall chrischall deleted the fix/release-oidc-no-stale-npm-token branch May 21, 2026 19:52
@chrischall chrischall added the ci CI / build pipeline changes label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci CI / build pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant