Sanitized Struct
A type that sanitizes a given string by removing control characters and escaping special characters to prevent log injection attacks.
public readonly record struct Sanitized : System.IEquatable<Abblix.Utils.Sanitized>Implements System.IEquatable<Sanitized>
Properties
Sanitized.Source Property
The original, untrusted value. Sanitization is applied lazily inside ToString(); reading this property directly bypasses sanitization and exposes raw input.
public object? Source { get; init; }Property Value
Methods
Sanitized.ToString() Method
Returns the sanitized string representation of the source string.
public override string ToString();Returns
System.String
A sanitized string with control characters removed and special characters escaped.
Sanitized.Value(object) Method
Creates a new Sanitized instance with the specified source object.
public static Abblix.Utils.Sanitized Value(object? source);Parameters
source System.Object
The source object to be sanitized when converted to string.
Returns
Sanitized
A new Sanitized instance.
Operators
Sanitized.implicit operator Sanitized(string) Operator
Wraps a raw string in a Sanitized value so the stripping pass runs once at formatting time.
public static Abblix.Utils.Sanitized implicit operator Abblix.Utils.Sanitized(string? source);Parameters
source System.String
The raw string to sanitize; may be null.
Returns
Sanitized.implicit operator Sanitized(Uri) Operator
Wraps a System.Uri in a Sanitized value so the stripping pass runs once at formatting time. The URI is converted to its string form before sanitization.
public static Abblix.Utils.Sanitized implicit operator Abblix.Utils.Sanitized(System.Uri? source);Parameters
source System.Uri
The URI to sanitize; may be null.