Custom PII Blacklist
The Custom PII Blacklist is a Tier 1 (in-process, sub-millisecond) guardrail that masks admin-defined sensitive terms before they reach the model and restores them in the response. It is suited for protecting client names, internal project codenames, employee surnames, and any other terms that must not appear in prompts sent to external AI providers.
Custom PII Blacklist editor
⚠️ Caution: A Custom PII guardrail with no usable keywords masks nothing — it is stored and listed, but the gateway returns
passfor it on every request.GET /admin/v1/gateways/<ID>/detectorsreports such a detector asactive: falsewithinactive_reason: "no_keywords", and the Guardrail Builder badges it No keywords.
When to use the Custom PII Blacklist
Use the Custom PII Blacklist when you need to prevent specific, known strings from reaching the model — and when you need the model response to contain the original values again. Unlike the Keyword guardrail, which blocks, flags or scrubs traffic (the scrub is not reversible), the Custom PII Blacklist is transparent to both the caller and the model: the caller sends the original text, the model sees masked tokens, and the caller receives the original text in the response.
For NLP-based PII detection (email addresses, card numbers, names inferred from context), use the NLP PII Detector or PII Protector instead.
How it works
The guardrail intercepts each request and response in two phases.
Request phase: Each keyword in the keywords list is replaced with an opaque token in the format [MYRA-CUSTOM:SALT:N], where SALT and N follow the PII Protector token derivation: SALT is stable for the turns of one conversation (per request without a conversation) and N is an id derived from the keyword under a key that never appears in the token (k followed by 7 hex digits — never a long digit run a number-shaped regex pattern could mistake for an ID) — the same keyword gets the same token on every turn of a conversation (so a prompt prefix that carries it stays byte-identical and prompt-cacheable), and the token cannot be checked against a guessed keyword. (Earlier releases used a per-request SALT and a sequential N.) Message text is scanned under the same role rule as PII Protector (the skip_system_messages row); this detector differs in that the system role is never scanned, whatever skip_system_messages or a mandate says: system and developer messages, the native top-level system prompt, instructions, and system or developer message items inside input are left exactly as sent. Everything else the caller sends is scanned: message text, plain-string content elements, tool results (a string or nested text blocks), the string values of a tool_use input (a tool_use input that is itself a string is masked as text), the arguments of an earlier assistant tool call (OpenAI-compatible tool_calls[].function.arguments, the legacy function_call.arguments, a Responses function_call item), the top-level prompt, and input (a string, an array of strings, or Responses-API items including function_call_output). Tool-call arguments are masked value by value: when they are one valid JSON object, keys, numbers and whitespace stay byte-identical and the call is still valid JSON; any other non-empty arguments string is masked as whole text. Object keys are not masked: a keyword used as a key name in tool arguments reaches the model as written. In tool-call arguments that are not one valid JSON object, each complete string value is decoded before matching (so M\u00fcller matches a keyword Müller), with two exceptions: a keyword that itself contains a double quote or a backslash is matched only as written, not in its escaped form; and when the arguments end inside an unfinished string value (cut-off JSON), escapes are not decoded, so only the literal spelling is matched. In arguments that are a valid JSON object, escaped values are decoded and masked. The same scope applies to the stored content the gateway composes into a chat's system prompt: a keyword in a memory or the profile (custom instructions included) is masked (file names are replaced by stand-in names); a keyword in the project instructions, the organization policy or a task prompt (system text) is not — see PII Protector — Stored content in the system prompt. The request body with masked values is forwarded to the model.
Response phase: Every token in the model response is replaced with the original keyword value before the response is returned to the caller — in one left-to-right pass over the response, so a restored keyword value is never rescanned for further tokens (a [MYRA-CUSTOM:…] token inside a keyword's value is rendered as [redacted]; see PII Protector — Restore is one pass, one level). If the model writes a token without its square brackets (MYRA-CUSTOM:…), it is restored the same way when it belongs to the conversation, and replaced by [redacted] when it does not.
A [MYRA-CUSTOM:…] token survives a later PII Protector scan on the same request intact: the NER detector clips its spans to the prose around the request's own tokens, so a keyword protected here is never re-masked into an unrestorable token and round-trips verbatim through that scan. The same protection holds between two Custom PII detectors: when a second Custom PII detector runs over text that already contains the first detector's [MYRA-CUSTOM:…] tokens, a keyword occurrence that intersects such a token is skipped — a keyword hit inside a token is not a real hit — so the first detector's token stays byte-intact and its value round-trips verbatim. A keyword occurrence lying wholly in real text is still redacted; only a match overlapping a token's synthetic bytes is left as-is (for a keyword whose literal contains a bracket and straddles a token edge, the real-text remainder outside the token is not re-scanned, but the token is never corrupted).
Web-search queries: the keywords of the Custom PII detectors that apply to the role (and the signed-in user's personal keywords) are also applied to the model-written web-search query before it leaves: a matching keyword is removed from the query, and a query left with nothing else is not sent (the model gets a "search skipped" result).
Tool results: the same keyword masking runs on text a server-side tool returns (a fetched page, a file read, a RAG chunk, an MCP result, a web-search result) before it reaches the model — including the signed-in user's personal PII keywords and the request-phase Custom PII detectors their role adds, exactly as in the prompt. A long web page is returned in windows (see paging); a keyword cut by a window's start or end is matched against the surrounding page text, so the window carries the keyword's token at that edge rather than the uncovered half of the keyword (the token restores to the whole keyword).
Workflow trigger content: the keywords are also masked in an email body, an email attachment or a form upload before a workflow stores it; a masker error there withholds the content rather than storing it raw — see Workflow trigger content.
The token mapping persists for the lifetime of the request. When the request egresses to an external AI provider the model never receives the original keyword values. A request served wholly by a first-party local (Myra/EU) model is not masked — the keywords reach the local model as-is, since the data never leaves Myra (see PII Protector — Local model legs are not masked).
💡 Note: The masking is fully reversible within a single request. Stored logs contain the masked form (tokens, not original values) when
log_payloads: trueis configured. Exception: the turn replay record, kept by default for model evaluation, stores the messages as the client sent them — before any guardrail — for the tenant's replay retention (30 days by default) unless the tenant is opted out.💡 Note: Case-folding covers ASCII, the Latin-1 Supplement (so
MÜLLERfolds tomüller) and Latin Extended-A (ŁUKASZ→łukasz,ŠTĚPÁN→štěpán; since October 2026). Letters of other scripts are never folded and match only exactly as entered, so enter them in the case they appear in the text. The Case sensitive option does not change this; it only makes the folded letters exact too.
Multi-word terms
A term of two or more words (for example Project Orion) matches the exact phrase and also these forms of it:
- snake case:
Project_Orion - kebab case:
Project-Orion - joined:
ProjectOrion(withcase_sensitive: falsethis also coversprojectorionandprojectOrion) - re-spaced: words split on
_,-,.or a camelCase boundary are joined with one space
The words are split at every character that is not a letter or digit, and before an ASCII capital that follows a lower-case letter or a digit. A term is expanded only when it has at least 2 words, each word has at least 2 characters, and the term has at least 6 characters in total. The generated forms always match whole words, also when whole_word is false; the exact term keeps the whole_word setting. All forms of one term share one token, and the answer gets the term as you configured it.
⚠️ Caution: A term whose words join into a common word (
Data Base→database,Log In→login) also masks that common word everywhere, including in tool results. Use distinctive terms.
A term that is not valid UTF-8 matches only exactly.
Configuration reference
| Field | Type | Default | Description |
|---|---|---|---|
type |
string | — | Must be "custom_pii" |
name |
string | — | Human-readable label for this guardrail instance |
target |
string | "request" |
request or both. Masking always runs on the request. The gateway puts the original values back into the answer on every path of a turn that masked, also with request; both adds the response-phase restore of this detector. The Guardrail Builder creates the card with both. |
keywords |
array of strings | [] |
Sensitive terms to mask. Empty and non-text entries are ignored. A term of two or more words also matches its separator and case variants (see Multi-word terms). |
case_sensitive |
boolean | false |
When false, matching is case-insensitive across ASCII, Latin-1 and Latin Extended-A accented letters (Ä↔ä, Ł↔ł); other scripts are not folded. When true, only the exact capitalisation matches. |
whole_word |
boolean | false |
When true, a keyword only matches when surrounded by non-word characters. When false, substring matches also apply. A word character is a letter or digit of any script; spaces, line breaks, punctuation, quotes such as »…«, currency signs, symbols and emoji border a word (since October 2026 — before, a keyword next to », € or an emoji did not match). |
💡 Note: The Custom PII Blacklist does not have an
actionfield. Masking is always active and cannot be configured to block or flag. A write that introduces or changes anactionother than"scrub"is rejected with400; a value already stored on that detector is carried through so an older configuration stays saveable.GET /gateways/{id}/detectorsreports this detector's action as"scrub"regardless of what is stored — see the PII Protector note for the full rule.
Example configuration
Mask client names in a customer support gateway
{
"type": "custom_pii",
"name": "client-name-mask",
"target": "both",
"keywords": ["Acme Corp", "Globex", "Initech"],
"case_sensitive": false,
"whole_word": true
}
Mask internal codenames with exact case
{
"type": "custom_pii",
"name": "project-codename-mask",
"target": "both",
"keywords": ["Project Nightingale", "Operation Keystone"],
"case_sensitive": true,
"whole_word": true
}
Configuring the Custom PII Blacklist
Proceed as follows to configure the Custom PII Blacklist in the Guardrail Builder:
- Open the gateway page (Organisation › AI setup › Gateways) and its Guardrails & residency tab with the Guardrails card.
- Click on the Custom PII Blacklist button.
- A collapsed Custom PII Blacklist card appears at the bottom of the list.
- Click on the card to expand it.
- Enter a name in the Name text field.
- Enter each sensitive term in the Sensitive terms text field and click on the Add button (pressing Enter also adds it).
- The term is added as a removable chip below the field. A term that is already in the list is not added again.
- If required, activate the Case sensitive checkbox for exact-case matching.
- If required, activate the Whole-word matching checkbox to prevent substring matches.
- Click on the Save Guardrails button.
-> The Custom PII Blacklist is saved and appears in the execution plan.
JSON number fields are not inspected
This detector reads text only. A value sent as a JSON number (a card number, an ID, a timestamp) is not inspected or changed by it. To catch or mask numeric fields use the regex or keyword guardrail, which scan the whole request body.
Pipeline position
The Custom PII Blacklist is Tier 1 — it runs in-process with no external calls. All Tier 1 guardrails run before any Tier 2 guardrail.
The masking and restoration phases operate independently of other guardrails in the pipeline. Other Tier 1 guardrails that run after the Custom PII Blacklist inspect the already-masked request body — the original keyword values are not visible to them.