Skip to content
Snippets Groups Projects
Unverified Commit 9e093633 authored by Kevin James's avatar Kevin James Committed by GitHub
Browse files

fix(auth): fix HTTP Basic auth for NOPASS indexes (#8442)

parent 4eaa81ac
No related branches found
Tags 32.150.1
No related merge requests found
......@@ -39,7 +39,7 @@ export function applyAuthorization(inOptions: GotOptions): GotOptions {
options.headers.authorization = `Bearer ${options.token}`;
}
delete options.token;
} else if (options.password) {
} else if (options.password !== undefined) {
// Otherwise got will add username and password to url and header
const auth = Buffer.from(
`${options.username || ''}:${options.password}`
......
......@@ -15,7 +15,7 @@ export function applyHostRules(url: string, inOptions: GotOptions): GotOptions {
const { username, password, token, enabled } = foundRules;
if (options.headers?.authorization || options.password || options.token) {
logger.trace({ url }, `Authorization already set`);
} else if (password) {
} else if (password !== undefined) {
logger.trace({ url }, `Applying Basic authentication`);
options.username = username;
options.password = password;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment