Skip to content

Commit 9198416

Browse files
authored
Don't show proxy password in NpmV1 task (#10930)
1 parent 7613519 commit 9198416

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Tasks/NpmV1/npmtoolrunner.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,17 @@ export class NpmToolRunner extends tr.ToolRunner {
100100
options.env['NPM_CONFIG_USERCONFIG'] = this.npmrc;
101101
}
102102

103+
function sanitizeUrl(url: string): string {
104+
const parsed = parse(url);
105+
if(parsed.auth) {
106+
parsed.auth = "***:***";
107+
}
108+
return format(parsed);
109+
}
110+
103111
let proxy = NpmToolRunner._getProxyFromEnvironment();
104112
if (proxy) {
105-
tl.debug(`Using proxy "${proxy}" for npm`);
113+
tl.debug(`Using proxy "${sanitizeUrl(proxy)}" for npm`);
106114
options.env['NPM_CONFIG_PROXY'] = proxy;
107115
options.env['NPM_CONFIG_HTTPS-PROXY'] = proxy;
108116

Tasks/NpmV1/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"version": {
1111
"Major": 1,
1212
"Minor": 154,
13-
"Patch": 4
13+
"Patch": 5
1414
},
1515
"runsOn": [
1616
"Agent",

Tasks/NpmV1/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"version": {
1111
"Major": 1,
1212
"Minor": 154,
13-
"Patch": 4
13+
"Patch": 5
1414
},
1515
"runsOn": [
1616
"Agent",

0 commit comments

Comments
 (0)