From 0304821dd98317f75a28b8f53fd907eb64e49780 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Fri, 6 Mar 2020 12:11:17 -0800 Subject: [PATCH] fix: create new guid for crash reporter This id should never be sent to telemetry for GDPR reasons, hence we don't reuse any of existing persistent ids like instanceId etc. --- src/vs/platform/storage/node/storageIpc.ts | 12 +++++++++++- src/vs/platform/telemetry/common/telemetry.ts | 1 + src/vs/workbench/electron-browser/window.ts | 10 ++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/storage/node/storageIpc.ts b/src/vs/platform/storage/node/storageIpc.ts index a6f2367f35540..94cc9a065770b 100644 --- a/src/vs/platform/storage/node/storageIpc.ts +++ b/src/vs/platform/storage/node/storageIpc.ts @@ -12,7 +12,7 @@ import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle'; import { onUnexpectedError } from 'vs/base/common/errors'; import { ILogService } from 'vs/platform/log/common/log'; import { generateUuid } from 'vs/base/common/uuid'; -import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey, currentSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry'; +import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey, currentSessionDateStorageKey, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry'; type Key = string; type Value = string; @@ -54,6 +54,16 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC this.logService.error(error); } + // This is unique to the application instance and thereby + // should be written from the main process once. + // + // THIS SHOULD NEVER BE SENT TO TELEMETRY. + // + const crashReporterId = this.storageMainService.get(crashReporterIdStorageKey, undefined); + if (crashReporterId === undefined) { + this.storageMainService.store(crashReporterIdStorageKey, generateUuid()); + } + // Apply global telemetry values as part of the initialization // These are global across all windows and thereby should be // written from the main process once. diff --git a/src/vs/platform/telemetry/common/telemetry.ts b/src/vs/platform/telemetry/common/telemetry.ts index d1125e0ffb36a..0bbc17972f5a5 100644 --- a/src/vs/platform/telemetry/common/telemetry.ts +++ b/src/vs/platform/telemetry/common/telemetry.ts @@ -45,3 +45,4 @@ export const instanceStorageKey = 'telemetry.instanceId'; export const currentSessionDateStorageKey = 'telemetry.currentSessionDate'; export const firstSessionDateStorageKey = 'telemetry.firstSessionDate'; export const lastSessionDateStorageKey = 'telemetry.lastSessionDate'; +export const crashReporterIdStorageKey = 'crashReporter.guid'; diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index 65d334eae04cc..18685e8d4944a 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -13,7 +13,7 @@ import { IAction } from 'vs/base/common/actions'; import { IFileService } from 'vs/platform/files/common/files'; import { toResource, IUntitledTextResourceInput, SideBySideEditor, pathsToEditors } from 'vs/workbench/common/editor'; import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { ITelemetryService, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry'; import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IRunKeybindingInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows'; import { ITitleService } from 'vs/workbench/services/title/common/titleService'; import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService'; @@ -46,7 +46,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { MenubarControl } from '../browser/parts/titlebar/menubarControl'; import { ILabelService } from 'vs/platform/label/common/label'; import { IUpdateService } from 'vs/platform/update/common/update'; -import { IStorageService } from 'vs/platform/storage/common/storage'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IPreferencesService } from '../services/preferences/common/preferences'; import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/node/menubar'; import { withNullAsUndefined, assertIsDefined } from 'vs/base/common/types'; @@ -104,7 +104,8 @@ export class ElectronWindow extends Disposable { @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, @IElectronEnvironmentService private readonly electronEnvironmentService: IElectronEnvironmentService, @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, - @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService + @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService, + @IStorageService private readonly storageService: IStorageService, ) { super(); @@ -544,12 +545,13 @@ export class ElectronWindow extends Disposable { const appCenterURL = isWindows ? appCenterConfig[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? appCenterConfig[`linux-x64`] : appCenterConfig.darwin; const info = await this.telemetryService.getTelemetryInfo(); + const crashReporterId = this.storageService.get(crashReporterIdStorageKey, StorageScope.GLOBAL)!; // base options with product info const options: CrashReporterStartOptions = { companyName, productName, - submitURL: appCenterURL.concat('&uid=', info.machineId, '&iid=', info.instanceId), + submitURL: appCenterURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', info.sessionId), extra: { vscode_version: product.version, vscode_commit: product.commit || ''