Skip to content

Commit 23e8976

Browse files
committed
Remove PII from version info (#2948)
1 parent fea4771 commit 23e8976

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/client/common/process/pythonProcess.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ export class PythonExecutionService implements IPythonExecutionService {
3434
]);
3535

3636
const json = JSON.parse(jsonValue) as { versionInfo: PythonVersionInfo; sysPrefix: string; sysVersion: string; is64Bit: boolean };
37+
const version_info = json.versionInfo;
38+
// Exclude PII from `version_info` to ensure we don't send this up via telemetry.
39+
for (let index = 0; index < 3; index += 1) {
40+
if (typeof version_info[index] !== 'number') {
41+
version_info[index] = 0;
42+
}
43+
}
44+
if (['alpha', 'beta', 'candidate', 'final'].indexOf(version_info[3]) === -1) {
45+
version_info[3] = 'unknown';
46+
}
3747
return {
3848
architecture: json.is64Bit ? Architecture.x64 : Architecture.x86,
3949
path: this.pythonPath,

src/client/common/process/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type ExecutionFactoryCreationOptions = {
5454
export interface IPythonExecutionFactory {
5555
create(options: ExecutionFactoryCreationOptions): Promise<IPythonExecutionService>;
5656
}
57-
export type ReleaseLevel = 'alpha' | 'beta' | 'candidate' | 'final';
57+
export type ReleaseLevel = 'alpha' | 'beta' | 'candidate' | 'final' | 'unknown';
5858
// tslint:disable-next-line:interface-name
5959
export type PythonVersionInfo = [number, number, number, ReleaseLevel];
6060
export type InterpreterInfomation = {

0 commit comments

Comments
 (0)