Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Incorrect authorization prefix for basic auth, and undocumented env var #454

Merged
merged 5 commits into from
Apr 12, 2024

Conversation

plumpNation
Copy link
Contributor

@plumpNation plumpNation commented Apr 11, 2024

Changes auth type header strings to use Basic prefix for base64 encoded username:password.

In addition, it seems like an undocumented env var COREPACK_NPM_USER is being used in tests, meaning that this value will be undefined and the user will always get a 401 as the documented env var is COREPACK_NPM_USERNAME.
This bit me when I was using a test to help debug why my COREPACK_NPM_REGISTRY was being ignored when running yarn --version in real life.

@plumpNation plumpNation marked this pull request as ready for review April 11, 2024 15:39
@plumpNation plumpNation changed the title Incorrect authorization headers for basic auth with username and password fix: Incorrect authorization prefix for basic auth, and undocumented env var Apr 11, 2024
sources/httpUtils.ts Outdated Show resolved Hide resolved
The location of the registry should be validated against the input.origin. With the current code, it simply checks to see if DEFAULT_NPM_REGISTRY_URL exists.

I made the registries into an array to make a regression less likely.
sources/httpUtils.ts Outdated Show resolved Hide resolved
@aduh95 aduh95 merged commit 2d63536 into nodejs:main Apr 12, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants