Table of Contents

Class SensitiveContentEgressGuard

Namespace
MailFathom.Application.SensitiveContent.Egress
Assembly
MailFathom.Application.dll

The one thing every egress point calls before it hands text to somebody else.

public sealed class SensitiveContentEgressGuard
Inheritance
SensitiveContentEgressGuard
Inherited Members

Remarks

One guard rather than a redaction per consumer, for the reason there is one redactor behind it: a placeholder a caller composed itself would drift from the shared one the first time either gained a rule, and a consumer holding the redactor directly would decide for itself what to do with a finding. What a consumer gets here is guarded text and nothing else — the findings stay inside, are counted by category, and are never handed to a caller that might log one.

Guard a value, never a composed document. A detected region is replaced wherever it was found, so a scan of a document this system assembled — an XML envelope, a JSON payload, a formatted listing — can report a region that covers a delimiter as well as the text beside it, and replacing that region would destroy the structure while leaving the value's neighbours in it. Every consumer that owns the values therefore guards the field it is about to write and composes afterwards.

One consumer cannot: a port handed a conversation somebody else built has no way to tell which turn a mailbox reached, so it guards each turn whole and accepts the structural cost above on a turn that happens to be a document. That is the exception rather than a second rule, and it is bounded by the guarantee that makes it necessary — every text leaves that port scanned, whatever its caller composed.

With both switches off this guard is inert. It is registered whatever a deployment configured, so no consumer carries a null check or a second code path, and with no redactor behind it every call returns its argument without constructing a detector, taking a concurrency permit, or touching an instrument. That is what makes an opt-in nobody took cost nothing on any of these paths.

Constructors

SensitiveContentEgressGuard(SensitiveContentRedactor?, ISensitiveContentEgressTelemetry, TimeProvider)

Initializes the guard of a deployment, whether or not it scans anything.

Properties

IsActive

Gets whether this deployment scans anything at all.

Methods

GuardAllAsync(SensitiveContentEgressPoint, IReadOnlyList<string>, CancellationToken)

Guards every text of one publication about to cross out of this deployment.

GuardAsync(SensitiveContentEgressPoint, string, CancellationToken)

Guards one text about to cross out of this deployment.

GuardOptionalAsync(SensitiveContentEgressPoint, string?, CancellationToken)

Guards a text that a message need not carry at all.

GuardWithOmissionAsync(SensitiveContentEgressPoint, string, CancellationToken)

Guards one text and reports what the analyzed ceiling kept out of it.