Skip to content

chore(ci): switch to OIDC trusted publishing and harden workflows#422

Merged
cchanxzy merged 1 commit into
mainfrom
chore/oidc-trusted-publishing
Mar 18, 2026
Merged

chore(ci): switch to OIDC trusted publishing and harden workflows#422
cchanxzy merged 1 commit into
mainfrom
chore/oidc-trusted-publishing

Conversation

@cchanxzy
Copy link
Copy Markdown
Owner

Switch to OIDC Trusted Publishing and harden CI workflows

Summary

  • Replace static NPM_TOKEN secret with OIDC trusted publishing in the release workflow
  • Add explicit least-privilege permissions blocks to all workflows missing them (pr.yml, playwright.yml, examples.yml)
  • Upgrade JamesIves/github-pages-deploy-action from v3.6.2 to v4 in examples.yml
  • Upgrade github/codeql-action from v2 to v3 in codeql-analysis.yml
  • Upgrade actions/checkout to v5, actions/setup-node to v6, actions/upload-artifact to v5 across all workflows
  • Upgrade Node.js from 22 to 24 across all workflows

Why

npm revoked all classic (legacy) tokens in December 2025. Granular access tokens with write permissions are capped at 90 days, requiring manual rotation. OIDC trusted publishing eliminates long-lived tokens entirely -- GitHub Actions proves its identity directly to npm using short-lived credentials scoped to a single job run.

Workflows without explicit permissions blocks run with overly broad default permissions. Pinning to least-privilege reduces blast radius if a workflow is compromised. Outdated actions (CodeQL v2, github-pages-deploy v3) miss security patches and may lose upstream support.

Changes by workflow

Workflow Change
release.yml Add permissions block with id-token: write, remove NPM_TOKEN env var
pr.yml Add permissions: contents: read
playwright.yml Add permissions: contents: read
examples.yml Add permissions: contents: write, upgrade deploy action to v4
codeql-analysis.yml Upgrade codeql-action from v2 to v3
All workflows actions/checkout v5, actions/setup-node v6, Node.js 24
playwright.yml actions/upload-artifact v5

@cchanxzy cchanxzy merged commit 2216be2 into main Mar 18, 2026
5 checks passed
@cchanxzy cchanxzy deleted the chore/oidc-trusted-publishing branch March 18, 2026 07:19
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 4.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant