Class ProtoUriSanitizer

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Text-level redaction for the addresses integrations trace: URI user-info (credentials) is removed unconditionally, and the values of well-known sensitive query parameters are replaced. Shared by HTTP, gRPC, messaging and web so one policy cannot drift between packages.

public static class ProtoUriSanitizer
Inheritance
ProtoUriSanitizer
Inherited Members

Fields

RedactedValue

The value sensitive parameters are replaced with.

public const string RedactedValue = "[REDACTED]"

Field Value

string

Properties

DefaultSensitiveQueryParameters

The query parameter names redacted when an integration has no rule of its own. The shared redaction defaults, plus key, so traced URLs redact what state values redact.

public static IReadOnlyList<string> DefaultSensitiveQueryParameters { get; }

Property Value

IReadOnlyList<string>

Methods

ForDiagnostics(string?)

The diagnostic form of a request address: user info removed and the query and fragment dropped, so a logged request URL cannot leak a token through a query parameter the policy does not know.

public static string? ForDiagnostics(string? address)

Parameters

address string

Returns

string

ForDisplay(string?)

The display form of an address for a trace field or an artifact: user info removed, everything else - including the query and fragment - kept. A value that is not an absolute address is returned as it is, so a location is never dropped.

public static string? ForDisplay(string? address)

Parameters

address string

Returns

string

Sanitize(string, IReadOnlyCollection<string>?)

Sanitizes an address with the supplied sensitive query parameter names.

public static string Sanitize(string address, IReadOnlyCollection<string>? sensitiveQueryParameters = null)

Parameters

address string
sensitiveQueryParameters IReadOnlyCollection<string>

Returns

string

Sanitize(Uri?, IReadOnlyCollection<string>?)

Sanitizes an address with the default sensitive query parameter names.

public static string? Sanitize(Uri? address, IReadOnlyCollection<string>? sensitiveQueryParameters = null)

Parameters

address Uri
sensitiveQueryParameters IReadOnlyCollection<string>

Returns

string

WithoutUserInfo(string)

Removes user:password@ from an address, leaving everything else untouched.

public static string WithoutUserInfo(string address)

Parameters

address string

Returns

string