npm / npm/rfcs

[RRFC] Feature Request: Adding Bitbucket Pipelines as a trusted NPM publisher

Open
#846 5 comments 63 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
777
Forks
267
PR merge metrics
No merged PRs in 30d

Description

[RRFC] Feature Request: Add Bitbucket Pipelines as a trusted NPM publisher

Motivation

Npm currently does not support Bitbucket Pipelines as a trusted publisher and now that classic tokens are no longer supported we want to ensure users are able to publish to NPM without being reliant on tokens.

This will allow us to stay up to date with security best practices and allow users to enable NPM into their CI/CD workflow more easily.

We have added the ability to enable NPM as an audience so this integration is possible

source: https://github.blog/changelog/2025-11-05-npm-security-update-classic-token-creation-disabled-and-granular-token-changes/
source: https://docs.npmjs.com/trusted-publishers

How
Current Behaviour

Currently bitbucket pipelines is not a trusted publisher so users have to rely upon tokens to publish to NPM.

Desired Behaviour

Currently Github Actions & Gitlab CI/CD are able to be selected as a publisher with configurations to control publishing access we want an equivalent for Bitbucket Pipelines that looks something like:

Publisher

Bitbucket Pipelines

Workspace*             /       Repo*

{workspaceUuid}     /      {RepositoryUuid}

Deployment UUID (Optional)

{deploymentEnvironmentUuid}

Authorising the trusted publisher

The OIDC token will have the following attributes inside that can be used to verify the publisher is the same as the configured trusted publisher

  • workspaceUuid
  • repositoryUuid
  • deploymentEnvironmentUuid

Example of claims

{
	"sub": "{60518816-1111-1111-1111-555555c267ed}:{2df4c531-1111-1111-1111-5555556048f8c}:{stepUuid}",
	"aud": "ari:cloud:bitbucket::workspace/3a8a18b2-1111-1111-1111-55555519a6f30",
	"stepUuid": "{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx}",
	"deploymentEnvironmentUuid": "{2df4c531-1111-1111-1111-5555556048f8c}",
	"iss": "https://api.bitbucket.org/2.0/workspaces/bitbucket-workspace/pipelines-config/identity/oidc",
	"repositoryUuid": "{60518816-1111-1111-1111-555555c267ed}",
	"branchName": "xxxxxxxxx",
	"exp": "xxxxxxxxxx",
	"iat": "xxxxxxxxxx",
	"pipelineUuid": "{xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxx}",
	"workspaceUuid": "{3a8a18b2-1111-1111-1111-55555519a6f30}"
}
Authenticating the OIDC Token

The pipeline will send a JWT containing claims containing information that is needed to authorise the pipeline to publish to NPM.

The JWT can then be authenticated using RSA keys found via:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing trusted publisher implementations for GitHub Actions and GitLab CI/CD, then compare their configuration and OIDC authorization requirements with the Bitbucket Pipelines claims described here. Done means Bitbucket Pipelines can be configured as a trusted publisher and its JWT can be authenticated and checked against the configured workspace, repository, and optional deployment UUIDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication, ci-cd, release
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.