Skip to content

ci(release): drop token plumbing — OIDC trusted publishers only#120

Merged
stackbilt-admin merged 1 commit intomainfrom
ci/npm-oidc-only
Apr 18, 2026
Merged

ci(release): drop token plumbing — OIDC trusted publishers only#120
stackbilt-admin merged 1 commit intomainfrom
ci/npm-oidc-only

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Root cause found for the v0.12.0 E404 on @stackbilt/adf: the workflow's token plumbing was short-circuiting the OIDC flow that trusted publishers require.

  • actions/setup-node's registry-url: 'https://registry.npmjs.org' option writes ~/.npmrc with //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}.
  • npm CLI sees that config and uses token auth for the publish PUT — even with --provenance and trusted publishers configured on every package.
  • With NPM_TOKEN now revoked at the account level (per trusted-publisher migration), the token string is a dead value. npm's stealth 404 for unauthorized writes is what we've been seeing.

Change

Two deletions from .github/workflows/release.yml:

  1. registry-url: 'https://registry.npmjs.org' removed from actions/setup-node — stops .npmrc generation.
  2. env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} removed from the "Publish to npm" step — nothing reads it.

With both gone, npm CLI sees id-token: write + --provenance + trusted publisher configured per package, and uses OIDC for both provenance signing AND publish auth. This is the end-state trusted publishers are designed for.

Why this is the right fix (not "regenerate the token")

Trusted publishers exist specifically to eliminate long-lived tokens from CI. Keeping the token plumbing as belt-and-braces was defensive but actively harmful here — .npmrc's _authToken takes precedence over OIDC regardless of --provenance.

Test plan

  • Merge.
  • gh workflow run release.yml -f tag=v0.12.0 — idempotent, nothing published yet for 0.12.0.
  • All 11 @stackbilt/* packages publish via OIDC at 0.12.0.
  • Provenance badge appears on each package's npmjs.com page.
  • Follow-up PR: delete the now-unused NPM_TOKEN repo secret via gh secret delete NPM_TOKEN --repo Stackbilt-dev/charter.

Related

🤖 Generated with Claude Code

Root cause of the v0.12.0 E404 on adf: actions/setup-node's
registry-url option writes ~/.npmrc with
`//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`, which makes
npm CLI prefer token auth for the PUT request — even with
--provenance flag and trusted publishers configured for the
package. With NPM_TOKEN now revoked on the account side, the
token string is dead, the publish PUT returns 404 (npm's stealth
rejection for unauthorized write).

Fix:
1. Drop `registry-url` from setup-node — prevents .npmrc generation.
2. Drop `NODE_AUTH_TOKEN` env from the publish step — nothing reads it.

With neither present, npm CLI sees `id-token: write` +
`--provenance` + trusted publisher configured on each package,
and uses OIDC for both provenance signing AND publish auth.

The NPM_TOKEN repo secret becomes irrelevant after this change
and can be deleted in a follow-up PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 9e156c2 into main Apr 18, 2026
3 checks passed
@stackbilt-admin stackbilt-admin deleted the ci/npm-oidc-only branch April 18, 2026 11:41
stackbilt-admin pushed a commit that referenced this pull request Apr 18, 2026
The prior fix (#120) removed token plumbing expecting npm's
`--provenance` flag to drive OIDC-based publish auth. It doesn't —
`--provenance` only signs attestations via OIDC. Publish auth via
OIDC for trusted publishers requires **npm 11.5.1+**, which is
newer than what setup-node bundles with Node 20 (currently ~10.x).

Result: v0.12.0 publish returned ENEEDAUTH — the CLI had no token
(correct end state) but didn't know how to use OIDC for auth.

Fix: install npm@latest globally before the publish step. 11.12.1
as of 2026-04-18 has first-class trusted-publisher OIDC auth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stackbilt-admin added a commit that referenced this pull request Apr 18, 2026
The prior fix (#120) removed token plumbing expecting npm's
`--provenance` flag to drive OIDC-based publish auth. It doesn't —
`--provenance` only signs attestations via OIDC. Publish auth via
OIDC for trusted publishers requires **npm 11.5.1+**, which is
newer than what setup-node bundles with Node 20 (currently ~10.x).

Result: v0.12.0 publish returned ENEEDAUTH — the CLI had no token
(correct end state) but didn't know how to use OIDC for auth.

Fix: install npm@latest globally before the publish step. 11.12.1
as of 2026-04-18 has first-class trusted-publisher OIDC auth.

Co-authored-by: Kurt Overmier <kurt@stackbilt.dev>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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