[BUG] npm config set unpacks _auth into username/password
Open
Nobody has claimed this yet.
Bug
Priority 2
Release 8.x
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
- relates to #2300
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
npm config set registry <url> messed up pre-existing ~/.npmrc containing _auth
$ cat ~/.npmrc
//registry.npmjs.org/:username=user
//registry.npmjs.org/:_password="cGFzcw=="
registry=https://npm.example.com/
Expected Behavior
$ cat ~/.npmrc
_auth=dXNlcjpwYXNz
registry=https://npm.example.com/
Steps To Reproduce
- Using the latest official node container image:
docker run -it --rm docker.io/library/node:17.9.0-alpine ash - Update to the latest
npmnpm install -g npm@8.7.0 - Having a existing
~/.npmrccontaining_auth:cat << EOF > ~/.npmrc _auth=$(echo -n 'user:pass' | base64) EOF - Set the container registry:
npm config set registry https://npm.example.com - Now the
.npmrcis messed upcat ~/.npmrc://registry.npmjs.org/:username=user //registry.npmjs.org/:_password="cGFzcw==" registry=https://npm.example.com/
Environment
- npm:
v8.5.0v8.7.0 - Node.js:
v16.14.2v17.9.0 - OS Name: Alpine Linux
v3.11v3.15 - System Model Name: Linux (in VM)
- npm config: (empty before reproduction)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Node 17 Alpine container, npm 8.7.0, and the sample ~/.npmrc, then trace the npm config set registry entry point and its handling of _auth credentials. Done means updating the registry no longer unpacks _auth into username and password, while preserving the expected .npmrc content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100