Skip to content

Commit 7abda6f

Browse files
authored
azure: Add masking to VerifyProviderStep (#1781)
1 parent 8d5c012 commit 7abda6f

File tree

5 files changed

+83
-77
lines changed

5 files changed

+83
-77
lines changed

azure/package-lock.json

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

azure/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@microsoft/vscode-azext-azureutils",
33
"author": "Microsoft Corporation",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"description": "Common Azure utils for developing Azure extensions for VS Code",
66
"tags": [
77
"azure",
@@ -42,7 +42,7 @@
4242
"@azure/core-client": "^1.6.0",
4343
"@azure/core-rest-pipeline": "^1.9.0",
4444
"@azure/logger": "^1.0.4",
45-
"@microsoft/vscode-azext-utils": "^2.2.0",
45+
"@microsoft/vscode-azext-utils": "^2.5.7",
4646
"semver": "^7.3.7",
4747
"uuid": "^9.0.0"
4848
},
@@ -53,7 +53,7 @@
5353
"@azure/core-auth": "^1.3.2",
5454
"@azure/core-paging": "^1.2.1",
5555
"@microsoft/eslint-config-azuretools": "^0.2.1",
56-
"@microsoft/vscode-azext-dev": "^2.0.0",
56+
"@microsoft/vscode-azext-dev": "^2.0.4",
5757
"@microsoft/vscode-azureresources-api": "^2.0.3",
5858
"@types/mocha": "^7.0.2",
5959
"@types/node": "^16.0.0",

azure/src/createAzureClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function parseClientContext(clientContext: InternalAzExtClientContext): I
2020
// Make sure to copy over just the subscription info and not any other extraneous properties
2121
return Object.assign(clientContext[0], {
2222
credentials: subscription.credentials,
23+
createCredentialsForScopes: subscription.createCredentialsForScopes,
2324
subscriptionDisplayName: subscription.subscriptionDisplayName,
2425
subscriptionId: subscription.subscriptionId,
2526
subscriptionPath: subscription.subscriptionPath,

azure/src/tree/AzureAccountTreeItemBase.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export abstract class AzureAccountTreeItemBase extends AzExtParentTreeItem imple
144144
const subscriptionId: string = nonNullProp(filter.subscription, 'subscriptionId');
145145
return await this.createSubscriptionTreeItem({
146146
credentials: <AzExtServiceClientCredentials>filter.session.credentials2,
147+
createCredentialsForScopes: () => { return Promise.resolve(filter.session.credentials2) },
147148
subscriptionDisplayName: nonNullProp(filter.subscription, 'displayName'),
148149
subscriptionId,
149150
subscriptionPath: nonNullProp(filter.subscription, 'id'),

azure/src/wizard/VerifyProvidersStep.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import type { Provider, ResourceManagementClient } from '@azure/arm-resources';
7-
import { AzureWizardExecuteStep, IParsedError, ISubscriptionActionContext, parseError } from '@microsoft/vscode-azext-utils';
7+
import { AzureWizardExecuteStep, IParsedError, ISubscriptionActionContext, maskUserInfo, parseError } from '@microsoft/vscode-azext-utils';
88
import { l10n, Progress } from 'vscode';
99
import * as types from '../../index';
1010
import { createResourcesClient } from '../clients';
@@ -40,6 +40,7 @@ export class VerifyProvidersStep<T extends ISubscriptionActionContext> extends A
4040
} catch (error) {
4141
// ignore and continue with wizard. An error here would likely be confusing and un-actionable
4242
const perror: IParsedError = parseError(error);
43+
const maskedErrorMessage: string = maskUserInfo(perror.message, []);
4344

4445
/**
4546
* @param providerError
@@ -49,8 +50,8 @@ export class VerifyProvidersStep<T extends ISubscriptionActionContext> extends A
4950
* @param providerErrorV2
5051
* A duplicate replacement of the `providerError` telemetry property.
5152
*/
52-
context.telemetry.properties.providerError = perror.message;
53-
context.telemetry.properties.providerErrorV2 = perror.message;
53+
context.telemetry.properties.providerError = maskedErrorMessage;
54+
context.telemetry.properties.providerErrorV2 = maskedErrorMessage;
5455
}
5556
}));
5657
}

0 commit comments

Comments
 (0)