Skip to navigation

PII Redaction plugin

The PII Redaction plugin finds personal data in what the client sends and masks it, replaces it with a short hash, or refuses the request. The same rules scrub MCP tools/call results before the client gets them, and the copies of the request and of MCP tool results that the gateway keeps for traces and LLM logs. The upstream receives the rewritten body. On a standalone data plane that has no control plane, the plugin doesn’t rewrite request bodies yet.

Where it runs

ProtocolsLLM routes (the prompt) and MCP routes (the JSON-RPC request, and tool results)
Scope kindsglobal, service, route
PhaseRequest

LLM answers aren’t scrubbed on the way to the client. Only their copies on traces and in LLM logs are.

Configuration

FieldTypeDefaultDescription
entitiesobjectNoneMaps an entity to an action. Entities are email, credit_card, ssn, aws_key, phone, and ip. The console shows this under Customize per type.
default_actionstringmaskThe action for entities that entities doesn’t name: mask, hash, or block. The console labels this Default action, and its Redact PII switch turns scanning off.
hash_saltstringNoneThe salt for the hash action. The console labels this Hash salt.

The actions do the following:

  • mask replaces a match with its type, for example [EMAIL].
  • hash replaces a match with its type and 8 hexadecimal characters of a salted SHA-256, for example [EMAIL:1a2b3c4d]. The same value gives the same hash across requests.
  • block refuses the request with 422. Nothing is rewritten.
  • off doesn’t scan for that entity.

phone and ip are scanned only when entities names them, because their patterns match ordinary numbers and version strings. With no configuration, the plugin masks email addresses, card numbers, US social security numbers, and AWS access key IDs. Card numbers must pass the Luhn check.

Example

{
"name": "redact-prompts",
"plugin_id": "pii-redaction",
"scope": { "kind": "route", "name": "openai-route" },
"config": {
"default_action": "mask",
"entities": { "credit_card": "block", "email": "hash", "phone": "mask" },
"hash_salt": "my-salt"
}
}