From 30b3d4d9e9c1f96be970b6b3bd213410156ceed5 Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Thu, 24 Aug 2023 10:00:27 +0200 Subject: [PATCH 1/2] assign to the telemetry trusted value the value associated to the property, not the actual property name itself. --- src/common/baseTelemetryReporter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/baseTelemetryReporter.ts b/src/common/baseTelemetryReporter.ts index 65f98ad..98c67e7 100644 --- a/src/common/baseTelemetryReporter.ts +++ b/src/common/baseTelemetryReporter.ts @@ -118,7 +118,7 @@ export class BaseTelemetryReporter { for (const property of Object.keys(modifiedProperties ?? {})) { if (typeof property === "string") { // Trusted values are not sanitized, which is what we want for raw telemetry - modifiedProperties[property] = new this.vscodeAPI.TelemetryTrustedValue(property); + modifiedProperties[property] = new this.vscodeAPI.TelemetryTrustedValue(modifiedProperties[property]); } } From fc3d4d09968e3e76acbb4ff2b58f41f94ff69b3b Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Thu, 24 Aug 2023 10:36:49 +0200 Subject: [PATCH 2/2] changing it so that we access the right value --- src/common/baseTelemetryReporter.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/baseTelemetryReporter.ts b/src/common/baseTelemetryReporter.ts index 98c67e7..d692147 100644 --- a/src/common/baseTelemetryReporter.ts +++ b/src/common/baseTelemetryReporter.ts @@ -115,10 +115,11 @@ export class BaseTelemetryReporter { */ public sendRawTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void { const modifiedProperties = { ...properties }; - for (const property of Object.keys(modifiedProperties ?? {})) { - if (typeof property === "string") { + for (const propertyKey of Object.keys(modifiedProperties ?? {})) { + const propertyValue = modifiedProperties[propertyKey]; + if (typeof propertyKey === "string" && propertyValue !== undefined) { // Trusted values are not sanitized, which is what we want for raw telemetry - modifiedProperties[property] = new this.vscodeAPI.TelemetryTrustedValue(modifiedProperties[property]); + modifiedProperties[propertyKey] = new this.vscodeAPI.TelemetryTrustedValue(typeof propertyValue === 'string' ? propertyValue : propertyValue.value); } }