Skip to content

Commit

Permalink
Whitelist attached-container remote authority (#79077)
Browse files Browse the repository at this point in the history
* allow attached-container

* Move cleanRemoteAuthority function to common location
  • Loading branch information
Rachel Macfarlane authored Aug 14, 2019
1 parent 57007c2 commit 09f774d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
16 changes: 1 addition & 15 deletions src/vs/platform/telemetry/browser/workbenchCommonProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';

import * as Platform from 'vs/base/common/platform';
import * as uuid from 'vs/base/common/uuid';
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';

export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
const result: { [name: string]: string | undefined; } = Object.create(null);
Expand Down Expand Up @@ -69,18 +70,3 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS
return result;
}

function cleanRemoteAuthority(remoteAuthority?: string): string {
if (!remoteAuthority) {
return 'none';
}

let ret = 'other';
// Whitelisted remote authorities
['ssh-remote', 'dev-container', 'wsl'].forEach((res: string) => {
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
ret = res;
}
});

return ret;
}
16 changes: 16 additions & 0 deletions src/vs/platform/telemetry/common/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,22 @@ export function validateTelemetryData(data?: any): { properties: Properties, mea
};
}

export function cleanRemoteAuthority(remoteAuthority?: string): string {
if (!remoteAuthority) {
return 'none';
}

let ret = 'other';
// Whitelisted remote authorities
['ssh-remote', 'dev-container', 'attached-container', 'wsl'].forEach((res: string) => {
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
ret = res;
}
});

return ret;
}

function flatten(obj: any, result: { [key: string]: any }, order: number = 0, prefix?: string): void {
if (!obj) {
return;
Expand Down
17 changes: 1 addition & 16 deletions src/vs/platform/telemetry/node/workbenchCommonProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';

export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
const result = await resolveCommonProperties(commit, version, machineId, installSourcePath);
Expand All @@ -30,19 +31,3 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS

return result;
}

function cleanRemoteAuthority(remoteAuthority?: string): string {
if (!remoteAuthority) {
return 'none';
}

let ret = 'other';
// Whitelisted remote authorities
['ssh-remote', 'dev-container', 'wsl'].forEach((res: string) => {
if (remoteAuthority!.indexOf(`${res}+`) === 0) {
ret = res;
}
});

return ret;
}

0 comments on commit 09f774d

Please sign in to comment.