Table of Contents

Class SensitiveContentDerivationGuard

Namespace
MailFathom.Application.SensitiveContent.Derivation
Assembly
MailFathom.Application.dll

The one thing every derived write calls before it copies mail text into a store of its own.

public sealed class SensitiveContentDerivationGuard
Inheritance
SensitiveContentDerivationGuard
Inherited Members

Remarks

Derived data is where redaction is cheapest and most durable: text redacted once stays redacted for every reader the chunk, the vector, and the search document ever have, and putting it back costs a re-derivation from raw MIME rather than a refetch from a mail server. So the derived path redacts on the way in, while SensitiveContentEgressGuard redacts on the way out — two boundaries, one SensitiveContentRedactor behind both for any one account, which is what keeps a citation drawn from a redacted chunk landing on the same redacted text when a reader opens the message.

Which account's mail is being derived is an argument rather than an ambient fact. Both paths that reach here already hold it — synchronization is running one account, and a re-derivation was enqueued for one account — so the posture is resolved from what the caller knows instead of from a scope somebody has to remember to open. The egress guard settles the same question differently, and says why in its own words: there the values are guarded several layers below whoever resolved the mail, and here they are not.

It carries the stamp as well as the redaction. A derived row records the configuration it was written under, so a scanner switched on over an already-indexed mailbox is answerable rather than silently partial: what was written under an older configuration is stale in exactly the sense an embedding profile already uses, and the way back is a rebuild. The stamp exists precisely when a redaction does, which is what makes "written under no scanner" and "written under this scanner" two readable states rather than one absence. It is one account's stamp rather than the deployment's, so a posture one account changed leaves no other account's rows stale.

With nothing switched on for an account this guard is inert. It is registered whatever a deployment configured, so no writer carries a null check or a second code path, and with no redaction behind its posture every call returns its argument without constructing a detector, taking a concurrency permit, or touching an instrument — and stamps nothing, so a derived row is byte-identical to the one the same message produced before this feature existed.

Constructors

SensitiveContentDerivationGuard(ISensitiveContentPostures, ISensitiveContentDerivationTelemetry, TimeProvider)

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

Properties

StampForEveryOtherAccount

Gets what a row belonging to an account the walk was not given a posture of is judged against.

Methods

GuardAsync(MailAccountId, string, CancellationToken)

Redacts one text about to be written into a derived store.

GuardTextAsync(MailAccountId, string, CancellationToken)

Redacts one text and reports where every placeholder ended up.

IsActiveAsync(CancellationToken)

Reads whether any account this deployment serves has what is derived from its mail redacted.

ReadAccountsBeyondDeploymentAsync(CancellationToken)

Reads what every account whose own record asks for more than the deployment has its mail derived under, ordered by account.

StampForAsync(MailAccountId, CancellationToken)

Reads the configuration a row of one account's mail written now records, or nothing where it is not scanned.