Class QueryGuardRedactor
- Namespace
- QueryGuard
- Assembly
- QueryGuard.Core.dll
The default IQueryGuardRedactor.
public sealed class QueryGuardRedactor : IQueryGuardRedactor
- Inheritance
-
QueryGuardRedactor
- Implements
- Inherited Members
Remarks
The literal scanner is a deliberately small single pass over the text. It is not a SQL parser,
and it never tries to understand the statement: it recognises quoted strings, bare numbers, and
comments, and leaves everything else exactly as it was. A parser would be more precise and would
also be a project of its own, kept in step with every provider's SQL generation, with every gap
in it becoming a leak. See docs/decisions/0005-sql-fingerprints.md.
Redaction is idempotent: redacting already-redacted SQL leaves it unchanged, so a value cannot reappear by passing through twice.
Constructors
- QueryGuardRedactor(QueryGuardCaptureOptions?)
Initializes a new instance of the QueryGuardRedactor class.
Fields
- LiteralPlaceholder
Replaces a redacted literal. Chosen to be recognisable in a report and to be inert if the text is ever pasted back into a SQL client.
- TruncationMarker
Appended when SQL is truncated, so a shortened statement is never mistaken for a whole one.
Properties
- Options
Gets the capture options this redactor enforces.
Methods
- FilterStackTrace(string?)
Filters framework frames out of a stack trace and truncates the result.
- LimitSamples<T>(IReadOnlyList<T>)
Trims a sample collection to the configured per-fingerprint limit.
- RedactSql(string?)
Redacts literals in a SQL statement and truncates it to the configured limit.