HIPAA PHI Detector
The hipaa-phi-detector policy is a text control for PHI. It checks request
messages before the upstream call. It also enables buffered response redaction
when the chain contains this policy. The detector uses the base PII engine and
HIPAA heuristics. These heuristics include names, addresses, fax numbers,
medical record numbers, and health-plan IDs. They also include license numbers,
device IDs, and biometric or photo terms.
Configuration
pack:
name: hipaa-phi-detector
version: "1.0.0"
enabled: true
policies:
chain:
- hipaa-phi-detector
policy:
hipaa-phi-detector:
action: redact
Fields
| Field | Type | Description | Default |
|---|---|---|---|
action | "redact" | "block" | Selects request behavior for PHI content. redact enables shared response redaction. block stops input, but output continues to use buffered redaction. | "redact" |
What the detector finds
The detector is heuristic and text-only. It uses the base PII detector with HIPAA-oriented matching rules.
Base PII engine
The shared detector contributes matches for items such as:
- email addresses
- Social Security numbers
- phone numbers
- public IP addresses
- URLs with specified paths or query strings
- dates
- account numbers
- ZIP codes
- license plates
HIPAA-oriented extensions
When the HIPAA detector is active, the gateway also looks for:
- person names
- street address and city terms
- fax numbers
- medical record numbers
- health-plan or policy identifiers
- certificate and driver's license numbers
- device identifiers and serial numbers
- biometric-identifier terms in text
- photo or facial-image terms in text
How it works
- Request check: The gateway makes one string from request messages and runs
hipaa-phi-detectorduring the input phase. - Detection: The gateway uses the general PII detector with HIPAA heuristics.
- Input verdict: A match returns the
redactorblockaction. - Response redaction: The chain entry also enables buffered output redaction for matching response text.
- The output path uses the shared redaction pipeline.
- Audit details: The event records the first match type, cause code, confidence counts, and redaction targets.
Important limitations
- This policy is not a formal HIPAA Safe Harbor certification engine.
- The policy configuration accepts only
action. - The policy checks text only. It does not check images, voice samples, or other non-text data.
- Use
stream: falsewhen HIPAA-specific response heuristics are necessary. The SSE redaction buffer does not prove that each HIPAA-specific match was changed.
Correct examples
Redact matching PHI-like content
pack:
name: hipaa-redaction
version: "1.0.0"
enabled: true
policies:
chain:
- hipaa-phi-detector
policy:
hipaa-phi-detector:
action: redact
Block PHI-like input before the model receives it
pack:
name: hipaa-block
version: "1.0.0"
enabled: true
policies:
chain:
- hipaa-phi-detector
policy:
hipaa-phi-detector:
action: block
Best practices
- Use
action: redactwhen the gateway must remove content and not reject the turn. - Pair
hipaa-phi-detectorwithhealthcare-compliancewhen PHI protection and medical-content controls are necessary. - Use
rbacfor minimum-necessary access rules. The HIPAA detector finds PHI-like text, but it does not authorize access. - Test typical PHI strings and examine emitted events before rollout.
Next steps
- PII Detector — Shared redaction controls and general PII detection
- Healthcare Compliance — Medical-output governance
- Human Oversight — Escalate sensitive outputs for review
- RBAC — Role, identity, and sensitivity-based access control