Problem
The anonymizeFilePaths() function in src/vs/platform/telemetry/common/telemetryUtils.ts redacts file paths in stack traces to strip PII. It relies on "cleanup patterns" (built from piiPaths) to preserve VS Code's own paths so they remain readable in telemetry. However, the browser telemetry service at src/vs/workbench/services/telemetry/browser/telemetryService.ts does not set piiPaths, unlike the electron-browser version which uses getPiiPathsFromEnvironment(environmentService).
In web environments (e.g. Codespaces), stack traces contain HTTPS URLs like:
at x3t._delegate (https://codespace-host.github.dev/static/build/bundle.js:1:200953)
The fileRegex in anonymizeFilePaths matches the URL path portion and redacts it to <REDACTED: user-file-path>, making the entire stack trace useless for debugging:
at x3t._delegate (https:/<REDACTED: user-file-path>:1:200953)
Root Cause
BrowserWorkbenchEnvironmentService doesn't implement the IPathEnvironment interface (appRoot, extensionsPath, userHome, tmpDir, userDataPath), so getPiiPathsFromEnvironment() can't be used. The browser telemetry config at line 117 of src/vs/workbench/services/telemetry/browser/telemetryService.ts omits piiPaths entirely. Without piiPaths, the only cleanup pattern is the static /(vscode-)?file:\/\/.*?\/resources\/app\//gi which doesn't match HTTPS URLs.
Impact
All error telemetry from VS Code web (vscode.dev, Codespaces) has fully redacted stack traces, making it impossible to identify which VS Code source file an error originates from.
Suggested Fix
Either:
- Add the web app's origin/base URL as a cleanup pattern so HTTPS bundle URLs are preserved, or
- Adjust
anonymizeFilePaths to not treat HTTPS URLs as file paths worth redacting (e.g. skip URLs matching https?://)
Related
Found while investigating #301212.
Problem
The
anonymizeFilePaths()function insrc/vs/platform/telemetry/common/telemetryUtils.tsredacts file paths in stack traces to strip PII. It relies on "cleanup patterns" (built frompiiPaths) to preserve VS Code's own paths so they remain readable in telemetry. However, the browser telemetry service atsrc/vs/workbench/services/telemetry/browser/telemetryService.tsdoes not setpiiPaths, unlike the electron-browser version which usesgetPiiPathsFromEnvironment(environmentService).In web environments (e.g. Codespaces), stack traces contain HTTPS URLs like:
The
fileRegexinanonymizeFilePathsmatches the URL path portion and redacts it to<REDACTED: user-file-path>, making the entire stack trace useless for debugging:Root Cause
BrowserWorkbenchEnvironmentServicedoesn't implement theIPathEnvironmentinterface (appRoot,extensionsPath,userHome,tmpDir,userDataPath), sogetPiiPathsFromEnvironment()can't be used. The browser telemetry config at line 117 ofsrc/vs/workbench/services/telemetry/browser/telemetryService.tsomitspiiPathsentirely. WithoutpiiPaths, the only cleanup pattern is the static/(vscode-)?file:\/\/.*?\/resources\/app\//giwhich doesn't match HTTPS URLs.Impact
All error telemetry from VS Code web (vscode.dev, Codespaces) has fully redacted stack traces, making it impossible to identify which VS Code source file an error originates from.
Suggested Fix
Either:
anonymizeFilePathsto not treat HTTPS URLs as file paths worth redacting (e.g. skip URLs matchinghttps?://)Related
Found while investigating #301212.