Skip to content
Snippets Groups Projects
Unverified Commit 6560beda authored by John Andrews's avatar John Andrews Committed by GitHub
Browse files

fix(manager/bundler): Escape special characters in bundler usernames (#32229)


Co-authored-by: default avatarRhys Arkins <rhys@arkins.net>
parent 7aa63f6d
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,15 @@ describe('modules/manager/bundler/host-rules', () => {
}),
).toBe('token');
});
it('escapes special characters in the username but not the password', () => {
expect(
getAuthenticationHeaderValue({
username: 'test@example.com',
password: 'p@ssword',
}),
).toBe('test%40example.com:p@ssword');
});
});
describe('findAllAuthenticatable()', () => {
......
......@@ -18,8 +18,9 @@ export function findAllAuthenticatable({
export function getAuthenticationHeaderValue(hostRule: HostRule): string {
if (hostRule.username) {
const username = encodeURIComponent(hostRule.username);
// TODO: types (#22198)
return `${hostRule.username}:${hostRule.password!}`;
return `${username}:${hostRule.password!}`;
}
// TODO: types (#22198)
......
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