Skip to content

Sanitize network errors#308688

Open
chrmarti wants to merge 1 commit intomainfrom
chrmarti/familiar-firefly
Open

Sanitize network errors#308688
chrmarti wants to merge 1 commit intomainfrom
chrmarti/familiar-firefly

Conversation

@chrmarti
Copy link
Copy Markdown
Collaborator

@chrmarti chrmarti commented Apr 9, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 9, 2026 07:03
@chrmarti chrmarti enabled auto-merge (rebase) April 9, 2026 07:03
@chrmarti chrmarti self-assigned this Apr 9, 2026
@chrmarti chrmarti marked this pull request as draft April 9, 2026 07:05
auto-merge was automatically disabled April 9, 2026 07:05

Pull request was converted to draft

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a targeted sanitizer for network-related error strings to reduce leaking hostnames/IPs/credentials into telemetry, and applies it to fetcher telemetry probe error reporting in the Copilot extension.

Changes:

  • Added sanitizeNetworkErrorForTelemetry() in the shared log service to redact proxy credentials/hosts, URL credentials, IPv4s, and FQDNs.
  • Added a Vitest suite covering common proxy/URL/IP/FQDN sanitization cases.
  • Updated fetcher telemetry probe error collection to sanitize error details before sending/recording.
Show a summary per file
File Description
extensions/copilot/src/platform/log/common/logService.ts Introduces sanitizeNetworkErrorForTelemetry() used to redact network identifiers in telemetry strings.
extensions/copilot/src/extension/log/vscode-node/test/sanitizeNetworkError.spec.ts Adds unit tests validating the sanitization behavior for proxy/URL/IP/FQDN patterns.
extensions/copilot/src/extension/log/vscode-node/loggingActions.ts Uses the new sanitizer for fetcher telemetry probe error strings.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/platform/log/common/logService.ts:420

  • This sanitizer claims to scrub IP addresses, but it only replaces IPv4 dotted quads. IPv6 addresses (e.g. 2001:db8::1, [2001:db8::1]:443, or NAT64 forms) will be left intact and can still contain sensitive network info in telemetry. Consider adding an IPv6 replacement (and corresponding tests) or explicitly documenting that IPv6 is not sanitized.
	// Replace IPv4 addresses, preserving the port if present
	message = message.replace(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g, '<ip>');
	// Replace FQDNs (at least one dot, TLD of 2+ alpha chars), preserving the port if present
	message = message.replace(/\b([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}\b/g, '<host>');
  • Files reviewed: 3/3 changed files
  • Comments generated: 3

@chrmarti chrmarti force-pushed the chrmarti/familiar-firefly branch 3 times, most recently from 4508d70 to 4e9275e Compare April 9, 2026 07:26
@chrmarti chrmarti marked this pull request as ready for review April 9, 2026 07:28
@chrmarti chrmarti enabled auto-merge (rebase) April 9, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants