Path: redb-route/redb.Route.Llm/Engine/Governance/IRedactionFilter.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm/Engine/Governance/IRedactionFilter.cs
----
namespace redb.Route.Llm.Engine.Governance;
///
/// Removes secrets / PII from strings before they are logged, persisted to
/// , or sent to observers. Applied to
/// both inbound user content and outbound model content, plus tool input/output.
///
public interface IRedactionFilter
{
///
/// Returns the redacted form of . Implementations
/// must be deterministic so re-saves don't re-redact already-masked tokens.
///
string Redact(string text, RedactionContext context);
}
/// Context flags that influence how a piece of text is redacted.
[Flags]
public enum RedactionContext
{
/// Unspecified.
None = 0,
/// Text is part of the user-supplied prompt.
UserInput = 1,
/// Text is model-generated content.
ModelOutput = 2,
/// Text is tool input JSON.
ToolInput = 4,
/// Text is tool output JSON.
ToolOutput = 8,
/// Text is going to be logged (vs stored).
Log = 16
}
/// Default redaction filter — returns the input untouched.
public sealed class NoopRedactionFilter : IRedactionFilter
{
///
public string Redact(string text, RedactionContext context) => text;
}