Skip to content

Commit

Permalink
Stop testing the endpoint if telemetry is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lramos15 committed Aug 27, 2021
1 parent 3abf6bc commit 1b4e1da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/browser/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*--------------------------------------------------------*/

import { ApplicationInsights } from "@microsoft/applicationinsights-web";
import * as vscode from "vscode";
import { AppenderData, BaseTelemtryReporter, ITelemetryAppender } from "../common/baseTelemetryReporter";

class WebAppInsightsAppender implements ITelemetryAppender {
Expand Down Expand Up @@ -32,7 +33,7 @@ class WebAppInsightsAppender implements ITelemetryAppender {

// If we cannot access the endpoint this most likely means it's being blocked
// and we should not attempt to send any telemetry.
if (endpointUrl) {
if (endpointUrl && vscode.env.isTelemetryEnabled) {
fetch(endpointUrl).catch(() => (this._aiClient = undefined));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/baseTelemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class BaseTelemtryReporter {
// Check for common user data in the telemetry events
if (value.indexOf("token=") !== -1) {
cleanedObject[key] = "<REDACTED: token>";
} else if (value.indexOf("ssword=") !== -1) {
} else if (value.indexOf("ssword=") !== -1 || value.indexOf("sswd=") !== -1) {
cleanedObject[key] = "<REDACTED: password>";
} else if (emailRegex.test(value)) {
cleanedObject[key] = "<REDACTED: email>";
Expand Down

0 comments on commit 1b4e1da

Please sign in to comment.