Skip to content

Harden npm trusted publishing workflow#178

Merged
kentcdodds merged 7 commits into
epicweb-dev:mainfrom
kody-bot:cursor/harden-npm-release-d34b
May 12, 2026
Merged

Harden npm trusted publishing workflow#178
kentcdodds merged 7 commits into
epicweb-dev:mainfrom
kody-bot:cursor/harden-npm-release-d34b

Conversation

@kody-bot

@kody-bot kody-bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move npm OIDC/id-token permission out of dependency install/build jobs
  • build package artifacts in an unprivileged job
  • publish from the generated artifact with package-manager caching disabled
  • set npm publish to ignore lifecycle scripts in the publish-authorized job
  • pin release-path actions to commit SHAs

Context

Triggered by the TanStack npm supply-chain compromise postmortem: https://tanstack.com/blog/npm-supply-chain-compromise-postmortem

Testing

  • workflow syntax checked by construction against the existing workflow shape

@kody-bot kody-bot marked this pull request as ready for review May 12, 2026 18:41
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
@kentcdodds kentcdodds merged commit 639f965 into epicweb-dev:main May 12, 2026
Comment on lines +78 to 86
publish:
name: 🚀 Release
needs: [build-release-artifact]
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
id-token: write # to enable use of OIDC for npm provenance
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

@Xiphe Xiphe May 13, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I've been doing on other projects lately is tying the OIDC on npm side to a dedicated github environment that requires review from a maintainer before being executed.

That way there's always a human in the loop with publishing. Happy to set that up and keeping an eye on it if you feel thats worth it @kentcdodds

Details

Looks like this on npm side:

Image Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd like to do that, go for it 👍

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.

3 participants