Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/security / guardrails / piiDetection

Function: piiDetection()

ts
function piiDetection<TValue>(opts?): GuardrailDefinition<TValue>;

Defined in: packages/security/src/guardrails/builtins/pii-detection.ts:144

Construct the PII detection guardrail.

Note on normalization (W-150): the boolean detect predicate (containsPii) matches against the NFKC + zero-width-stripped form of the text, so cheap character-injection obfuscation cannot dodge detection. The guardrail's REWRITE path (redactText / redactValue) deliberately keeps matching the raw text: offset-based replacement needs the original string, and a normalized-offset remap is not worth the complexity for a best-effort redactor.

Type Parameters

Type ParameterDefault type
TValueunknown

Parameters

ParameterType
optsPiiDetectionOptions

Returns

GuardrailDefinition&lt;TValue&gt;

Stable