Skip to content

[RRFC] Let a package register its own OIDC issuer for trusted publishing #924

Open

Description

@hyzyla

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:

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions