Table of Contents

Class QueryFingerprintFactory

Namespace
QueryGuard
Assembly
QueryGuard.Core.dll

The default IQueryFingerprintFactory: redact, then hash.

public sealed class QueryFingerprintFactory : IQueryFingerprintFactory
Inheritance
QueryFingerprintFactory
Implements
Inherited Members

Remarks

The identifier appears in allowlist configuration, in issue reports, and in CI output, so it has to be identical across runs, processes, and both target frameworks. GetHashCode() is randomized per process and is therefore disqualified; this uses an explicit SHA-256 digest truncated to eight hex characters.

Eight characters is 32 bits, which is short enough to paste into a configuration file or an issue title. Collisions are irrelevant at the scale that matters: a fingerprint only has to be unique among the handful of distinct statements inside one request or test, not globally.

Text is redacted before hashing, never after, so two commands differing only by an inlined value share an identifier, and no un-redacted text is ever retained.

Constructors

QueryFingerprintFactory(IQueryGuardRedactor?, ISqlNormalizer?)

Initializes a new instance of the QueryFingerprintFactory class.

Methods

Create(string?, QueryCommandKind)

Creates a fingerprint for a command.