Repository navigation
Description
PastaClaw flagged this while reviewing #5819, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.
Update checks cannot see releases on npm mirrors that require authentication (suggestion)
Impact: An operator whose npmrc points to a token-protected mirror gets an unknown candidate even though npm can see and install the release.
Where: packages/dashmate/src/update/resolveUpdateCandidate.js:836-866 at 740075a2e217:
platform/packages/dashmate/src/update/resolveUpdateCandidate.js
Lines 836 to 866 in 740075a
| const registry = await resolveRegistryUrl({ | |
| explicitUrl: registryUrl, | |
| env, | |
| npmGlobalPrefix, | |
| nodeExecPath, | |
| runCommand, | |
| pathExists, | |
| }); | |
| const details = { | |
| registryUrl: registry.url, | |
| registryUrlSource: registry.source, | |
| registryUrlIgnored: registry.ignored, | |
| distTag, | |
| }; | |
| if (registry.url === null) { | |
| const message = registry.reason === CANDIDATE_REASON.REGISTRY_CONFIG_UNREADABLE | |
| ? 'Could not read the configured npm registry for this installation' | |
| : 'The configured npm registry must be an HTTPS URL without credentials, a query, or a fragment'; | |
| return result( | |
| base, | |
| CANDIDATE_STATE.UNKNOWN, | |
| registry.reason, | |
| message, | |
| { source: CANDIDATE_SOURCE.NPM_REGISTRY, details }, | |
| ); | |
| } | |
| const response = await fetchJson(`${registry.url}${PACKAGE_NAME}/${distTag}`); |
The new npmrc lookup discovers the mirror URL but then queries it anonymously.
defaultFetchJsonsends only anAcceptheader, so a mirror that requires credentials for metadata returns an error or a 404 that Dashmate reports as package missing. Use the detected npm executable to query metadata with the same global prefix and registry as installation so npm applies its own credentials. Retain the timeout, output cap, and version validation.
Origin
- Pull request: feat(dashmate): add the modules that let dashmate update itself #5819
- Review thread: feat(dashmate): add the modules that let dashmate update itself #5819 (comment)
- Filed by PastaClaw when it accepted the deferral, as nothing else tracked it.
Activity