Repository navigation
fix(error-message): point E401 password recovery at the configured registry - #10034
toufiq-dev wants to merge 1 commit into
Conversation
|
Hi 👋 Friendly follow-up on this — it fixes #10014 (the I noticed CI hasn't run on the fork branch yet — if that's the first-time-contributor workflow approval, no stress, just flagging it in case someone with permissions wants to trigger the checks. Happy to make any changes to the message wording or fallback behavior — for example, if pointing at the registry root isn't the right recovery path for all private registries, I'm glad to adjust. Thanks! |
|
Hi 👋 One more (and last) nudge on this — it fixes #10014 and I understand review bandwidth is tight. It's ~4 weeks old now and I noticed the mergeability is being recomputed, so the base may have drifted from |
d738d70 to
0624d0b
Compare
What:
When an
E401(Basic realm) auth error comes from a private registry, the error message still pointed users athttps://www.npmjs.com/forgot, which is the wrong site entirely for Artifactory / GitHub Packages / Verdaccio / Nexus users. This changes the message to point at the root of the configured registry, and keepshttps://www.npmjs.com/forgotfor the default registry or when config is not loaded.Why:
Fixes #10014 — teams on internal mirrors see recovery instructions for the public npm registry, which is confusing during auth incidents.
How:
lib/utils/error-message.js(Basic-realm branch), readnpm.config.get('registry')whennpm?.loaded(the error handler can render beforenpm.loadcompletes, and tests may invokeerrorMessagewithoutnpm, so this degrades safely to the current URL)./forgotpage, as noted in the issue).https://registry.npmjs.org/) keep the existinghttps://www.npmjs.com/forgotlink, so no behavior change for the default case.Tests:
npmjs.com/forgot.npmnot loaded ({ loaded: false }) → no throw, keeps the npmjs.com fallback.npmjs.com/forgot, which remains correct).All 146 assertions in
test/lib/utils/error-message.jspass; eslint clean.New output for a private registry: