Skip to content

Update checks cannot see releases on npm mirrors that require authentication #6489

Backlog

Description

@thepastaclaw

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:

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. defaultFetchJson sends only an Accept header, 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions