Skip to content

Commit bd36637

Browse files
committed
Require validated Credential for credentialToStr
1 parent 4d0bec1 commit bd36637

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/start-proxy.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,14 @@ test("credentialToStr - hides passwords", (t) => {
396396
const credential = {
397397
type: "maven_credential",
398398
password: secret,
399+
url: "https://localhost",
399400
};
400401

401402
const str = startProxyExports.credentialToStr(credential);
402403

403404
t.false(str.includes(secret));
404405
t.is(
405-
"Type: maven_credential; Host: undefined; Url: undefined Username: undefined; Password: true; Token: false",
406+
"Type: maven_credential; Host: undefined; Url: https://localhost Username: undefined; Password: true; Token: false",
406407
str,
407408
);
408409
});
@@ -412,13 +413,14 @@ test("credentialToStr - hides tokens", (t) => {
412413
const credential = {
413414
type: "maven_credential",
414415
token: secret,
416+
url: "https://localhost",
415417
};
416418

417419
const str = startProxyExports.credentialToStr(credential);
418420

419421
t.false(str.includes(secret));
420422
t.is(
421-
"Type: maven_credential; Host: undefined; Url: undefined Username: undefined; Password: false; Token: true",
423+
"Type: maven_credential; Host: undefined; Url: https://localhost Username: undefined; Password: false; Token: true",
422424
str,
423425
);
424426
});

src/start-proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export async function getDownloadUrl(
455455
*
456456
* @param c The credential to convert to a string.
457457
*/
458-
export function credentialToStr(c: RawCredential): string {
458+
export function credentialToStr(c: Credential): string {
459459
return `Type: ${c.type}; Host: ${c.host}; Url: ${c.url} Username: ${
460460
c.username
461461
}; Password: ${c.password !== undefined}; Token: ${c.token !== undefined}`;

0 commit comments

Comments
 (0)