Repository navigation
Description
Motivation ("The Why")
Trusted publishing accepts OIDC tokens from three issuers: GitHub Actions, GitLab.com and CircleCI. Every other CI has to keep a long-lived write token.
The same request keeps arriving, once per provider:
- [RRFC] Feature Request: Adding Bitbucket Pipelines as a trusted NPM publisher #846 add Bitbucket Pipelines (61 upvotes)
- Support Trusted publishing for Github Actions Self-Hosted Runners #888 support self-hosted runners
- Support custom OIDC Identity Provider for Trusted Publishing cli#9104 support a custom OIDC provider, closed with "these types of discussions are best had in the rfcs repo" and never refiled
- self-managed GitLab and GitHub Enterprise have no issue at all
All four ask for the same thing. The issuer list is hardcoded, so every new CI needs npm to ship code.
Teams that run their own CI usually do it for security reasons, and they are the ones who cannot use this security feature. They keep long-lived write tokens instead. npm now caps the lifetime of those tokens, so those teams rotate secrets by hand forever.
Example
A company runs GitLab on gitlab.example.com. The pipeline already mints an OIDC token with the right claims, and npm rejects it because the issuer is not gitlab.com. So the company puts a write token in a CI variable, the token expires, the release pipeline breaks, and someone rotates it by hand.
How
Current Behaviour
npm checks the token issuer against a built-in list and rejects anything else.
Desired Behaviour
Let the package owner register an issuer when they set up a trusted publisher: the issuer URL, the expected sub claim, and any extra claims to match.
npm reads /.well-known/openid-configuration at setup time to check the issuer is valid, validates the token signature against that issuer's JWKS, and accepts the publish only when every registered claim matches. The owner proves control of the domain during setup.
This is opt-in per package. An owner who registers a weak issuer only affects their own package, and they already hold a write token that can do the same with less proof.
Provenance can stay as it is. A self-hosted issuer gives a weaker guarantee than a cloud runner, so these publishes can carry no provenance. Many teams want trusted publishing anyway.
#846 and #888 then become configuration.
References
- Replaces closed Support custom OIDC Identity Provider for Trusted Publishing cli#9104
- Generalises [RRFC] Feature Request: Adding Bitbucket Pipelines as a trusted NPM publisher #846 (Bitbucket Pipelines)
- Generalises Support Trusted publishing for Github Actions Self-Hosted Runners #888 (self-hosted runners)
- Related: [Feature Request] Document Trusted Publishing for unsupported CI/CD tools documentation#1860
- PyPI already does this for GitLab Self-Managed and GitHub Enterprise Server: https://blog.pypi.org/posts/2025-11-10-trusted-publishers-coming-to-orgs/
Activity