Skip to content

feat: lock publish to OIDC and a protected GitHub Environment#6

Merged
TheCryptoDonkey merged 1 commit intomainfrom
feat/oidc-lockdown-and-environment
Apr 23, 2026
Merged

feat: lock publish to OIDC and a protected GitHub Environment#6
TheCryptoDonkey merged 1 commit intomainfrom
feat/oidc-lockdown-and-environment

Conversation

@TheCryptoDonkey
Copy link
Copy Markdown
Member

Summary

Two orthogonal defences that complement the verify-lifecycle-scripts gate shipped in 0.9.0 (PR #5):

  • OIDC-only publish. publish-npm now fails if NPM_TOKEN, NODE_AUTH_TOKEN, NPM_CONFIG_PROVENANCE, or _authToken/_auth/_password material in .npmrc is present at publish time. publishConfig.provenance: true is enforced via package.json rather than a --provenance CLI flag (npm 11.6+ short-circuits to ENEEDAUTH when the flag is passed). Closes the "maintainer left a long-lived token in the release job" hole even after trusted publishing is configured.
  • Protected publish environment. release.yml attaches the publish job to the npm-publish GitHub Environment by default, exposed via a new publish-environment input. Consumers configure protection rules (required reviewers, prevent self-review, branch/tag restrictions) in that environment and bind npm trusted publishing to the same name, so OIDC publish cannot mint a token without going through the reviewer gate.

Migration guides, trusted-publisher README, and comparison doc updated to reflect the new npm-publish environment value. THREAT-MODEL gains two new rows under "defended against".

Test plan

  • npx bats test/*.bats — 144 / 144 pass (130 pre-existing + 11 verify-lifecycle-scripts + 3 new OIDC-enforcement tests)
  • Smoke-test the npm-publish Environment wiring on a real consumer repo
  • Confirm publishConfig.provenance: true is still the only provenance driver in the release flow

Two orthogonal defences that complement the verify-lifecycle-scripts
gate added in 0.9.0:

1. publish-npm refuses legacy npm token auth. Fails if NPM_TOKEN,
   NODE_AUTH_TOKEN, NPM_CONFIG_PROVENANCE, or _authToken/_auth/_password
   material in .npmrc is present at publish time. Also enforces
   publishConfig.provenance: true in package.json rather than relying
   on a CLI flag. Closes the "maintainer leaves a long-lived token
   lying around" hole even after OIDC is configured.

2. release.yml attaches the publish job to the npm-publish GitHub
   Environment by default, exposed via the publish-environment input.
   Consumers configure protection rules (required reviewers, prevent
   self-review, branch/tag restrictions) in that environment and bind
   npm trusted publishing to the same name, so OIDC publish cannot mint
   a token without going through the reviewer gate.

Migration guides, trusted-publisher README, and comparison doc all
updated to reflect the new npm-publish environment value. THREAT-MODEL
gains two rows under "defended against".
@TheCryptoDonkey TheCryptoDonkey merged commit 8add148 into main Apr 23, 2026
3 checks passed
@TheCryptoDonkey TheCryptoDonkey deleted the feat/oidc-lockdown-and-environment branch April 23, 2026 22:02
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