Skip to content

Commit

Permalink
azure: Add masking to VerifyProviderStep (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroFish91 authored Aug 27, 2024
1 parent 8d5c012 commit 7abda6f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 77 deletions.
145 changes: 74 additions & 71 deletions azure/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions azure/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-azext-azureutils",
"author": "Microsoft Corporation",
"version": "3.1.0",
"version": "3.1.1",
"description": "Common Azure utils for developing Azure extensions for VS Code",
"tags": [
"azure",
Expand Down Expand Up @@ -42,7 +42,7 @@
"@azure/core-client": "^1.6.0",
"@azure/core-rest-pipeline": "^1.9.0",
"@azure/logger": "^1.0.4",
"@microsoft/vscode-azext-utils": "^2.2.0",
"@microsoft/vscode-azext-utils": "^2.5.7",
"semver": "^7.3.7",
"uuid": "^9.0.0"
},
Expand All @@ -53,7 +53,7 @@
"@azure/core-auth": "^1.3.2",
"@azure/core-paging": "^1.2.1",
"@microsoft/eslint-config-azuretools": "^0.2.1",
"@microsoft/vscode-azext-dev": "^2.0.0",
"@microsoft/vscode-azext-dev": "^2.0.4",
"@microsoft/vscode-azureresources-api": "^2.0.3",
"@types/mocha": "^7.0.2",
"@types/node": "^16.0.0",
Expand Down
1 change: 1 addition & 0 deletions azure/src/createAzureClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function parseClientContext(clientContext: InternalAzExtClientContext): I
// Make sure to copy over just the subscription info and not any other extraneous properties
return Object.assign(clientContext[0], {
credentials: subscription.credentials,
createCredentialsForScopes: subscription.createCredentialsForScopes,
subscriptionDisplayName: subscription.subscriptionDisplayName,
subscriptionId: subscription.subscriptionId,
subscriptionPath: subscription.subscriptionPath,
Expand Down
1 change: 1 addition & 0 deletions azure/src/tree/AzureAccountTreeItemBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export abstract class AzureAccountTreeItemBase extends AzExtParentTreeItem imple
const subscriptionId: string = nonNullProp(filter.subscription, 'subscriptionId');
return await this.createSubscriptionTreeItem({
credentials: <AzExtServiceClientCredentials>filter.session.credentials2,
createCredentialsForScopes: () => { return Promise.resolve(filter.session.credentials2) },
subscriptionDisplayName: nonNullProp(filter.subscription, 'displayName'),
subscriptionId,
subscriptionPath: nonNullProp(filter.subscription, 'id'),
Expand Down
7 changes: 4 additions & 3 deletions azure/src/wizard/VerifyProvidersStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

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

/**
* @param providerError
Expand All @@ -49,8 +50,8 @@ export class VerifyProvidersStep<T extends ISubscriptionActionContext> extends A
* @param providerErrorV2
* A duplicate replacement of the `providerError` telemetry property.
*/
context.telemetry.properties.providerError = perror.message;
context.telemetry.properties.providerErrorV2 = perror.message;
context.telemetry.properties.providerError = maskedErrorMessage;
context.telemetry.properties.providerErrorV2 = maskedErrorMessage;
}
}));
}
Expand Down

0 comments on commit 7abda6f

Please sign in to comment.