Investigate NPM Trusted Publishing via CircleCI for Automatically Published Packages
Background
NPM Trusted Publishers is a security feature that allows CI/CD pipelines to publish packages to npm without long-lived authentication tokens. Instead, it uses OpenID Connect (OIDC) to exchange short-lived, scoped tokens at publish time — eliminating the need to store NPM_TOKEN as a secret in CircleCI.
As of April 2026, CircleCI is now a supported trusted publisher for npm, joining GitHub Actions. This opens the door for cypress-io/cypress to adopt this more secure publishing model.
References:
Problem
Currently, publishing packages from this monorepo relies on a long-lived NPM_TOKEN stored as a CircleCI environment variable/secret. This approach carries several risks:
- Token exposure: Long-lived tokens can be leaked through logs, compromised secrets stores, or supply chain attacks.
- Broad scope: A single token grants publish access to all packages and is not scoped to specific workflows or conditions.
- No automatic expiry: Tokens do not expire and must be manually rotated.
- Auditability gaps: It's harder to trace exactly which CI job triggered a publish.
Goal
Investigate and implement NPM Trusted Publishing (OIDC-based) for all automatically published packages in this monorepo, so that:
- No long-lived NPM tokens need to be stored in CircleCI secrets.
- Publish access is scoped to specific CircleCI workflows/jobs/branches (e.g., release pipelines on
main).
- The attack surface for supply chain compromise is significantly reduced.
Automatically Published Packages
The following packages in this monorepo are published to npm automatically via CircleCI and are in scope for this investigation:
@cypress/*
Investigation Tasks
Security Benefits
- ✅ No long-lived npm tokens stored as CI secrets
- ✅ Tokens are short-lived and scoped to the specific CircleCI job
- ✅ npm audit logs clearly identify the trusted publisher that performed each publish
- ✅ Accidental token leaks in logs or compromised secrets no longer grant publish access
- ✅ Aligns with npm's recommended best practice for automated publishing
Acceptance Criteria
References
Investigate NPM Trusted Publishing via CircleCI for Automatically Published Packages
Background
NPM Trusted Publishers is a security feature that allows CI/CD pipelines to publish packages to npm without long-lived authentication tokens. Instead, it uses OpenID Connect (OIDC) to exchange short-lived, scoped tokens at publish time — eliminating the need to store
NPM_TOKENas a secret in CircleCI.As of April 2026, CircleCI is now a supported trusted publisher for npm, joining GitHub Actions. This opens the door for
cypress-io/cypressto adopt this more secure publishing model.References:
Problem
Currently, publishing packages from this monorepo relies on a long-lived
NPM_TOKENstored as a CircleCI environment variable/secret. This approach carries several risks:Goal
Investigate and implement NPM Trusted Publishing (OIDC-based) for all automatically published packages in this monorepo, so that:
main).Automatically Published Packages
The following packages in this monorepo are published to npm automatically via CircleCI and are in scope for this investigation:
@cypress/*@cypress/angular@cypress/angular-zoneless@cypress/eslint-plugin-dev@cypress/grep@cypress/mount-utils@cypress/puppeteer@cypress/react@cypress/schematic@cypress/svelte@cypress/vite-dev-server@cypress/vite-plugin-cypress-esm@cypress/vue@cypress/webpack-batteries-included-preprocessor@cypress/webpack-dev-server@cypress/webpack-preprocessorInvestigation Tasks
npm publishcalls andNPM_TOKENusage across.circleci/config).cypress/@cypress) account can configure Trusted Publishers per-package via the npm web UI or API.releaseworkflow onmain, triggered by a specific pipeline/tag).NPM_TOKEN. CircleCI provides an OIDC token via$CIRCLE_OIDC_TOKEN; npm's--provenanceand OIDC flows need to be wired up accordingly.NPM_TOKENsecret: Once verified in a dry run / staging publish, remove theNPM_TOKENsecret from CircleCI project/org settings. (NOTE: verify other repos possibly using the organization context!)Security Benefits
Acceptance Criteria
NPM_TOKENis no longer required in CircleCI secrets for any publish job.NPM_TOKENschedule from engineering calendar and documentationReferences