A policy declares which types of sensitive information to look for and what to do with each one. It is the one thing every product shares: the same policy runs unchanged whether you embed Phileas in your own process or call Philter over HTTP.
Rather than writing one from scratch, start from a policy that already exists.
The policy library
The policies in pii-redaction-policies, Apache 2.0, are published as a browsable policy library with the full JSON for each.
| Category | Includes |
|---|---|
| AI training | LLM Training Data Preparation |
| Contact center | Contact Center Call Recording Transcripts |
| Education | FERPA Student Records Redaction |
| Finance | GLBA Nonpublic Personal Information (NPPI) Redaction, PCI DSS Scope Reduction, and more |
| General | Brazilian Identifiers (CPF, CNPJ), Canadian Social Insurance Number (SIN) Redaction, and more |
| Healthcare | Clinical Notes De-Identification (Date-Shifted), HIPAA Safe Harbor De-Identification, and more |
| Legal | Bankruptcy Rule 9037 (FRBP 9037) Court Filing Redaction, FRCP 5.2 Federal Civil Filing Redaction, and more |
Each page shows the policy JSON in full, so you can copy it directly or clone the repository and take the file.
Treat these as starting points, not compliance certifications. Detection is probabilistic, and you are responsible for validating a policy’s output against your own data.
Adapting a policy
A policy is a name plus a set of identifiers. Each identifier carries one or more filter strategies describing how to handle a match:
{
"name": "default",
"identifiers": {
"ssn": {
"ssnFilterStrategies": [
{ "strategy": "REDACT", "redactionFormat": "{{{REDACTED-%t}}}" }
]
}
}
}
The vocabulary is defined by the PhiSQL specification: 30 entity types and 14 strategies,
consumed by both Phileas and Philter. REDACT, MASK, HASH_SHA256, and
RANDOM_REPLACE cover most cases. ENCRYPT and FPE_ENCRYPT are the only reversible
ones. The
type system reference
is the authoritative list.
Applying a policy
Where the policy lives differs by product, and it is the most common thing to get wrong.
Phileas takes the policy directly. Build it as a dict or object in your code, or load it from a file you manage. Nothing is registered anywhere.
Philter reads policies from /opt/philter/policies/. A fresh instance has none, so a
filter request fails until you supply one. Mount a file at start, as the
quickstart shows, then select it per request with ?p=.
PhiSQL compiles to the same JSON, so it is an authoring choice rather than a different format:
POLICY ssn_only;
REDACT SSN WITH MASK;
Referential integrity
Passing a context groups documents that belong together. Within one context the same input value maps to the same replacement, so relationships across documents survive redaction. Use different contexts when documents should not share replacements.
This is consistent pseudonymization rather than anonymization: values are replaced with stand-ins, and only the encryption strategies can be reversed.
Building and measuring
The Redaction Policy Editor builds policies visually if you would rather not hand-edit JSON.
Philter Scope scores a policy on precision and recall against gold-standard data, which turns tuning into something with numbers attached rather than a guess.