Skip to content

[MTP Diagnostic Analysis] OpenTelemetry exports raw file paths, stdout/stderr, and stack traces without filtering #8411

Description

@Evangelink

Summary

The OpenTelemetry result pipeline emits raw file paths, stdout/stderr, exception text, stack traces, and artifact paths directly into activity tags. Unlike the App Insights telemetry pipeline, there is no hashing, redaction, or opt-in gate for these potentially sensitive values.

Evidence

  • Q:\src\testfx\src\Platform\Microsoft.Testing.Platform\Telemetry\OpenTelemetryResultHandler.cs:122-126
    • yield return new("test.file.path", testLocationProperty.FilePath);
    • yield return new("test.line.start", ...)
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Platform\Telemetry\OpenTelemetryResultHandler.cs:163-169
    • activity.SetTag("test.result", result);
    • activity.SetTag("test.result.exception.message", exception.Message);
    • activity.SetTag("test.result.exception.stacktrace", exception.StackTrace);
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Platform\Telemetry\OpenTelemetryResultHandler.cs:194-200
    • activity.SetTag("test.stdout", string.Join(...))
    • activity.SetTag("test.stderr", string.Join(...))
    • activity.SetTag($"test.artifact.file[{index}].path", fileArtifactProperty.FileInfo.FullName);
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.Telemetry\AppInsightsProvider.cs:54-78
    • the App Insights pipeline maintains a KnownUnhashedProperties allowlist
  • Q:\src\testfx\src\Platform\Microsoft.Testing.Extensions.Telemetry\AppInsightsProvider.cs:195-205,258-276
    • DEBUG builds assert that arbitrary string properties must be hashed or allow-listed.

Why this is a real issue

This is concrete, not theoretical: any configured OpenTelemetry exporter receives these raw values. Test stdout/stderr often contains secrets or environment-specific data, and full source/artifact paths expose local machine layout and repository structure. The privacy posture is also inconsistent with the App Insights telemetry codepath, which explicitly guards unhashed strings.

Suggested resolution

Add filtering/redaction controls for sensitive tags (at minimum file paths, stdout/stderr, exception messages/stack traces, artifact paths), and consider making the sensitive tags opt-in rather than on-by-default. Documentation should call out exactly which fields are exported.

Related issues

  • None found

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mtp-extensionsMTP extensions (TrxReport, Retry, HtmlReport, ...).type/automationCreated or maintained by an agentic workflow.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions