Skip to content

Error telemetry stack traces are fully redacted in web environments (Codespaces) #302289

@bryanchen-d

Description

@bryanchen-d

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:

  1. Add the web app's origin/base URL as a cleanup pattern so HTTPS bundle URLs are preserved, or
  2. Adjust anonymizeFilePaths to not treat HTTPS URLs as file paths worth redacting (e.g. skip URLs matching https?://)

Related

Found while investigating #301212.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugerror-telemetryVS Code - Issues generated by telemetryinsiders-releasedPatch has been released in VS Code InsiderstelemetryTelemetry system issueswebIssues related to running VSCode in the web

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions