Open
Conversation
Contributor
There was a problem hiding this comment.
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
extensions/copilot/src/extension/log/vscode-node/test/sanitizeNetworkError.spec.ts
Show resolved
Hide resolved
extensions/copilot/src/extension/log/vscode-node/test/sanitizeNetworkError.spec.ts
Outdated
Show resolved
Hide resolved
4508d70 to
4e9275e
Compare
4e9275e to
df76cee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.