Class SensitiveContentRedactor
- Namespace
- MailFathom.Application.SensitiveContent.Redaction
- Assembly
- MailFathom.Application.dll
Runs every switched-on scanner over a text and replaces what they found, once, for every consumer.
public sealed class SensitiveContentRedactor : IDisposable
- Inheritance
-
SensitiveContentRedactor
- Implements
- Inherited Members
Remarks
This is the single implementation the whole feature turns on. The derived path and the read path both redact through it, so a citation drawn from a redacted chunk lands on the same redacted text when a reader opens the message; two implementations would drift the moment either one gained a rule about ordering, overlap, or truncation.
The result is reproducible. For a given text, plan, and set of detector revisions, the redacted text is byte-identical on repeat: scanners run in a fixed order, findings are sorted before they are applied rather than applied in the order they arrived, and overlapping regions merge under a rule that does not depend on which detector answered first.
It fails closed. A detector that is absent, slow past the configured budget, broken, or reporting a region outside the text it was handed refuses the operation rather than returning the text unredacted. The one thing that never raises a failure is the analyzed ceiling: text beyond it is dropped from the result rather than passed on, so an over-long input costs the remainder instead of the whole operation.
Constructors
- SensitiveContentRedactor(SensitiveContentPlan, IEnumerable<ISensitiveContentScanner>, TimeProvider)
Initializes the redactor of a deployment with at least one scanner switched on.
Methods
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- RedactAsync(string, CancellationToken)
Scans a text and returns it with every detected region replaced by a placeholder.