Skip to content

Commit 380dfaa

Browse files
Mask Secret in artifacts common too (#332)
* Mask Secret in artifacts common too * add loc to module json
1 parent 5cc8d8b commit 380dfaa

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

common-npm-packages/artifacts-common/module.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"MSILoginFailed": "Azure login failed using Managed Service Identity",
1818
"ServiceConnections_Error_FailedToParseServiceEndpoint_MissingParameter": "Failed to parse the service endpoint '%s' because it was missing the parameter '%s'",
1919
"ServiceConnections_Error_FailedToParseServiceEndpoint_BadScheme": "Failed to parse the service endpoint '%s' because the auth scheme '%s' was invalid",
20-
"SettingAzureCloud": "Setting active cloud to: %s"
20+
"SettingAzureCloud": "Setting active cloud to: %s",
21+
"Info_GotAndMaskAuth":"Got auth token, setting it as secret so it does not print in console log"
2122
}
2223
}

common-npm-packages/artifacts-common/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common-npm-packages/artifacts-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-pipelines-tasks-artifacts-common",
3-
"version": "2.241.0",
3+
"version": "2.241.1",
44
"description": "Azure Artifacts common code (for new authentication tasks)",
55
"scripts": {
66
"build": "cd ../build-scripts && npm install && cd ../artifacts-common && node make.js"

common-npm-packages/artifacts-common/webapi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ export function getWebApiWithProxy(serviceUri: string, accessToken: string, opti
2020
return new api.WebApi(serviceUri, credentialHandler, {...defaultOptions, ...options});
2121
}
2222

23+
/** Return a masked SystemAccessToken */
2324
export function getSystemAccessToken(): string {
2425
tl.debug('Getting credentials for local feeds');
2526
const auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
2627
if (auth.scheme === 'OAuth') {
27-
tl.debug('Got auth token');
28+
tl.debug(tl.loc("Info_GotAndMaskAuth"));
29+
tl.setSecret(auth.parameters['AccessToken']);
2830
return auth.parameters['AccessToken'];
2931
} else {
3032
tl.warning('Could not determine credentials to use');

0 commit comments

Comments
 (0)