npm / npm/cli

Add a way to prevent `npm logout` from revoking the token in the `.npmrc`

Open
#8,900 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

At Canva we have some private packages we publish and consume from npm. In order to install these packages we need to issue readonly tokens.

We have ~1500 engineers which means that providing each engineer with access to the @canva/ scope so that they can issue their own personal tokens - so instead we use a single, read-only token checked-in to the repo in the root .npmrc file.

There is one major issue with this in that if anyone runs npm logout within a folder in the repo then it will revoke the token checked-in to the repo. This, of course, means that all npm installs break across all surfaces, and in turn this means an incident and an oncall page to notify someone to generate a new token and commit it to the repo to unbreak things.

We would love it if there was a way to physically block the npm logout command from running in the repo. For example something as simple as being able to set logout=false in the .npmrc to cause the npm logout command to fail would go a long way to close this incident vector.

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 locating the npm logout command and the handling of project-level .npmrc settings. Check how logout currently decides to revoke a token, then add coverage for a configuration that makes logout fail without revoking it. Done means the setting works from the repository’s .npmrc while existing logout behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.