nodejs / nodejs/admin

Migrate to OIDC on publishing npm packages in GitHub Actions

Open
#998 10 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
202
Forks
183
Avg merge
2m
Merged PRs (30d)
1

Description

See https://docs.npmjs.com/trusted-publishers for documentations.

[!note]
Trusted publishing requires npm CLI version 11.5.1 or later.

TL;DR: add the following section in the workflow file to replace ${secrets.NPM_TOKEN}, and create OICD connection on https://www.npmjs.com/package/<package-name>/access:

permissions:
  id-token: write  # Required for OIDC
  contents: read

This should help us get rid of npm tokens in GitHub Actions for publishing packages.

Quick search on npm token usages: https://github.com/search?q=org%3Anodejs+path%3A%22.github%2Fworkflows%22+%22npm+publish%22&type=code

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 with the unchecked workflow files listed in the issue, especially nodejs/node-core-test and nodejs/caritat, and compare them with the checked migrations. Verify the npm trusted-publisher requirements and existing workflow permissions first. Done means the remaining npm publishing workflows no longer use NPM_TOKEN and have the required OIDC configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd, release, security
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.