Skip to content

fix: accept setup-node placeholder NODE_AUTH_TOKEN and npmrc template#8

Merged
TheCryptoDonkey merged 1 commit intomainfrom
fix/setup-node-placeholder
May 3, 2026
Merged

fix: accept setup-node placeholder NODE_AUTH_TOKEN and npmrc template#8
TheCryptoDonkey merged 1 commit intomainfrom
fix/setup-node-placeholder

Conversation

@TheCryptoDonkey
Copy link
Copy Markdown
Member

Summary

  • actions/setup-node@v6 writes NODE_AUTH_TOKEN=XXXXX-XXXXX-XXXXX-XXXXX to GITHUB_ENV and _authToken=${NODE_AUTH_TOKEN} into the generated .npmrc whenever registry-url is set without a real token. See actions/setup-node src/authutil.ts.
  • npm 11.5+ ignores both during OIDC exchange, but anvil's strict null check on NODE_AUTH_TOKEN and the _authToken= regex in publish-npm.sh were both tripping on the placeholders before npm ever ran. Every consumer using anvil's reusable release.yml was hitting this — visible in failed runs across forgesworn repos where v0.2.x / v0.3.x publishes died on NODE_AUTH_TOKEN is set despite no real token being configured.
  • Whitelist the exact placeholder forms. Real tokens (anything else) still fail closed.

Why this matters

Without this fix, every anvil-published forgesworn package has been silently failing OIDC publish since the strict guard landed in v0.10.0. Manual republishes have been masking the regression.

Test plan

  • shellcheck -x steps/publish-npm.sh clean
  • bats test/*.bats — 147/147 pass, including four new cases:
    • rejects real NODE_AUTH_TOKEN
    • allows the literal XXXXX-XXXXX-XXXXX-XXXXX placeholder
    • rejects real _authToken=secret in .npmrc (existing test, still passes)
    • allows _authToken=${NODE_AUTH_TOKEN} template in .npmrc
  • After merge: re-run forgesworn/signet-verify release workflow on v0.3.1 and confirm OIDC publish succeeds (Trusted Publisher must also be configured at npmjs.com — separate admin step).

actions/setup-node@v6 exports NODE_AUTH_TOKEN=XXXXX-XXXXX-XXXXX-XXXXX
to GITHUB_ENV and writes _authToken=${NODE_AUTH_TOKEN} to the generated
.npmrc whenever registry-url is set without a real token. Both are
literal placeholders that npm 11.5+ ignores during OIDC exchange, but
the strict null/auth-material checks in publish-npm trip on them
before npm ever runs.

Whitelist the exact placeholder values. Anything else still fails
closed.

See actions/setup-node src/authutil.ts.
@TheCryptoDonkey TheCryptoDonkey merged commit 01d589e into main May 3, 2026
3 checks passed
@TheCryptoDonkey TheCryptoDonkey deleted the fix/setup-node-placeholder branch May 3, 2026 15:38
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