Skip to content

ci: tighten default token scope#486

Merged
mcous merged 3 commits into
testing-library:mainfrom
kody-bot:cursor/harden-npm-release-d34b
May 12, 2026
Merged

ci: tighten default token scope#486
mcous merged 3 commits into
testing-library:mainfrom
kody-bot:cursor/harden-npm-release-d34b

Conversation

@kody-bot
Copy link
Copy Markdown
Contributor

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

Why

@kentcdodds asked me to open this PR after reviewing the npm supply-chain risk described in the TanStack postmortem: https://tanstack.com/blog/npm-supply-chain-compromise-postmortem

This repository already uses npm trusted publishing/OIDC for semantic-release, so this hardens the workflow by keeping package build/dependency execution out of the privileged publishing job where feasible.

What changed

  • Build the package in an unprivileged job and upload the package output as a short-lived artifact.
  • Keep the release job focused on downloading the prebuilt artifact and running semantic-release with OIDC permissions.
  • Default workflow token permissions to read-only where the workflow did not already do so.

Notes

This follows the same pattern Kent has been applying to his own semantically-released trusted-publishing packages.

@kody-bot kody-bot changed the title Harden npm trusted publishing workflow ci: harden npm trusted publishing workflow May 12, 2026
@mcous mcous changed the title ci: harden npm trusted publishing workflow ci: tighten default token scope May 12, 2026
@mcous
Copy link
Copy Markdown
Collaborator

mcous commented May 12, 2026

I already had this workflow set up to separate the build step from the privileged publish flow. Adjusted PR title accordingly

CI failures are unrelated and due to drift in dev dependency versions - will fix this separately

@mcous mcous merged commit b92d2d8 into testing-library:main May 12, 2026
34 of 36 checks passed
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.

2 participants