Sensitive Data Rules
Two rules cover personal data and credentials on both directions:
provon.guard.pii— personal identity and financial data.provon.guard.secret-leak— API keys, access keys, JWTs, and private keys.
Both support audit, block, and transform. Detection is fully local — no external service is called —
and runs on parsed request values, so JSON unicode escapes such as \u0040 cannot hide an address,
and full-width digits, non-breaking spaces, and CJK/IDN addresses are normalised during matching.
Detectors#
Personal data#
| Category | Default | Detects | Validation |
|---|---|---|---|
email |
on | ASCII and internationalised mail addresses | Domain label structure; invalid dots/hyphens rejected |
credit_card |
on | 13–19 digit PANs with spaces, tabs, newlines, NBSP, hyphens, or full-width digits/hyphens | NFKC normalisation plus the Luhn checksum |
ssn |
on | US Social Security numbers (###-##-####, full-width hyphens accepted) |
Unissued area/group/serial combinations rejected |
ipv4 |
on | Dotted-quad addresses | Every octet must be 0–255; version-like runs rejected |
phone_number |
on | National and international numbers with +, area-code parens, or separator structure |
8–12 digits; separator structure required so dates and order numbers do not match |
url |
opt-in | Scheme-qualified http(s) URLs |
Parsable URL with a dotted hostname or localhost |
iban |
opt-in | ISO 13616 account numbers (space-free) | Country-specific length plus the mod-97 checksum |
Secrets#
| Category | Detects |
|---|---|
openai_api_key |
OpenAI-style API key material |
aws_access_key |
AWS access key id patterns |
jwt |
Signed JSON Web Token structure |
private_key |
PEM private key blocks |
Rule parameters#
- categories — optional allowlist of detector names; an unknown name is rejected at settings
write time with
400. Omitting it enables only the default-on detectors:email,credit_card,ssn,ipv4,phone_numberfor PII and all four secret detectors.urlandibanare opt-in because ordinary document links and a regional account format produce more noise. - maxAllowedMatches — number of distinct values tolerated before the rule triggers; defaults
to
0, meaning any match triggers. - allowedValues — explicit values that must never trigger (cards compare digit-only, case-insensitive for email), for example known sandbox fixtures.
- allowTestCards (
provon.guard.piionly) — suppresses a curated set of payment-provider test PANs while still detecting any other Luhn-valid number.
Redaction modes#
redactionMode selects how a matched value is replaced under Transform. The vocabulary follows
the standard redaction-operator taxonomy (Azure PII redaction policies, Microsoft Presidio).
placeholder (default)#
Replaces the value with an exchange-local typed placeholder such as <EMAIL_ADDRESS_1> or
<CREDIT_CARD_1>. The same value keeps the same placeholder within the exchange, and client
unmasking can restore caller-submitted originals on the response.
Placeholder labels are a closed set (EMAIL_ADDRESS, CREDIT_CARD, US_SSN, IP_ADDRESS,
PHONE_NUMBER, URL, IBAN, OPENAI_API_KEY, AWS_ACCESS_KEY, JWT, PRIVATE_KEY). Angle
brackets keep placeholders distinct from JSON/SSE framing characters. Placeholders are never
persisted or emitted in telemetry.
masking#
Replaces the value with an irreversible, human-readable partial mask: a***@example.com,
************4242, ***-**-6789, 10.*.*.*. Secret categories always become one fixed-width
******** mask. No key is required and there is no unmask path.
pseudonymization#
Replaces the value with an irreversible, deployment-wide deterministic keyed hash: a fixed-width,
version-tagged opaque surrogate h<keyId>.<base64url> derived with HMAC-SHA256. Every category —
including secrets — uses the same opaque shape.
- The same source value maps to the same surrogate across requests, so shared prompt prefixes stay byte-identical and upstream prefix/KV caches keep hitting.
- The Gateway fails closed (
500, no upstream call) when this mode is selected without a configured key version. - Key versions are configured server-side with
PROVON_GUARDRAIL_PSEUDONYMIZATION_KEYand an optionalPROVON_GUARDRAIL_PSEUDONYMIZATION_KEY_ID(lowercase alphanumeric, 1–8 chars, default1). Rotating id plus secret re-bases every surrogate and resets prefix-cache affinity.
Pseudonymization is GDPR Art. 4(5) pseudonymization, not anonymization: a deployment-wide key makes one person linkable across requests by design. Use
placeholderormaskingwhen cross-request linkability is not acceptable.
Client unmasking#
| Setting | Behaviour |
|---|---|
unmask: true (default) |
Under placeholder mode the model and stored traces still see placeholders, while the client response restores caller-submitted originals. |
unmask: false |
Placeholders remain visible on the client response as well. |
The exchange vault that maps placeholders back to values lives only in request state and is never
persisted, so unmasking cannot reconstruct values from another request. Restorable values are
limited to input-direction detections: PII the model itself produces stays replaced even with
unmasking on, and unknown or malformed placeholders pass through untouched. If multiple
data-protection rules run in one exchange, any irreversible mode or explicit unmask: false
disables restoration for the whole response.
Streaming behavior#
streamMode controls how streamed responses are scanned:
chunk(default) — scans decoded content from complete SSE events with a 256-character carry window per text/tool field. It does not wait for the complete answer, but buffers incomplete event framing, including a final event at EOF.segment— buffers and reassembles the entire response before checking. Only segment mode can guarantee that no unchecked fragment has already been delivered. Segment buffering only takes effect under Enforce; audit rules keep using content scanning.
Segment defaults: maxSegmentBytes 262144, maxSegmentDurationMs 30000; the tightest
configured caps win.
Placeholders are stable per exchange: the first distinct email becomes <EMAIL_ADDRESS_1>, a
repeated appearance reuses its placeholder, and on streamed responses each distinct value is counted
once across chunk boundaries while every appearance is still replaced. Transform rewrites only
the current chunk; when a match starts inside the carried-over tail and cannot be fully redacted,
the stream is aborted. Chunk mode cannot retract bytes already delivered — use segment mode when no
partial value may be exposed. Incomplete tool-argument JSON containing escapes cannot be certified
by a text-only incremental scanner and terminates enforcing chunk mode. Segment mode cannot replay
redacted wire bytes, so a Transform rule on a buffered segment is upgraded to Block, and the
upgrade is recorded as match evidence.
Unmasking restores streamed responses without corrupting SSE framing: complete placeholders inside one event are replaced in place, while a placeholder split across events holds its event until the fragment closes and then re-emits one structurally valid merged event. A truncated stream delivers the held bytes verbatim rather than inventing a value.
Evidence and privacy#
- Match evidence stores detector categories and snippet hashes, never the matched value.
- The local exact-response cache hashes post-redaction text, so redaction does not lower cache hit rates.
- Apply project telemetry retention to captured prompts and responses; guardrail events themselves carry no payload content.