A discovery scan tells you which kinds of PII a folder holds. The next step, writing a redaction policy that covers them, usually starts from a blank file or a generic policy that enables everything. Phinder can write the first draft for you: with --emit-policy, it turns the entity types it found into a redaction policy that Philter and Phileas load directly.
The draft enables exactly what the scan found, which includes whatever the scan found by mistake. This guide generates a starter policy from a small invented file share, shows how to spot the types that came from false positives, tunes the policy, and loads it into Philter.
Detection is probabilistic. A starter policy is a starting point to review and measure on your own data, not a finished control.
Before you start
You need:
- Phinder, built from source as described in Find the PII in a folder with Phinder.
--emit-policyis in the current source and is not in a published release yet. The examples call the JARphinder.jar. - A running Philter 4 with an API key in
PHILTER_API_KEY. The quick start covers both. jq, to edit the policy.
The share in this guide is five invented files under /mnt/claims-share: two claim notes, a Word file of vendor contacts, an onboarding checklist in Markdown, and a handbook excerpt with no PII.
1. Scan and write the policy
Run Phinder from a working directory, since it writes report.html and report.json to the current directory:
mkdir -p ~/scans/claims-share && cd ~/scans/claims-share
java -jar phinder.jar -i /mnt/claims-share -R --emit-policy starter-policy.json > console.txt 2> errors.txt
tail -2 console.txt
Wrote a starter redaction policy (JSON) to /home/analyst/scans/claims-share/starter-policy.json (9 entity type(s): bank-routing-number, date, email-address, first-name, phone-number, ssn, state-abbreviation, vin, zip-code).
This is a starter policy to review, tune, and measure (for example with Philter Scope) before relying on it. Redaction is probabilistic; validate it against your own data.
The policy enables each of the nine types with a REDACT strategy. Phinder writes every setting with its default value, so the file is long, but it is the standard policy format. A detected type that needs a custom policy to find, such as a custom identifier or PhEye name detection, is listed as skipped instead of being guessed at.
2. Check where each type came from
The scan’s console output lists every value it detected, with its type and confidence. That output contains PII, so keep it out of shared logs and delete it when you are done. Read it before you trust the policy. In this run, three of the nine types came only from values that are not PII:
PII found in claim-10483.txt:
- 10483 (type: zip-code, confidence: 0.50)
- 10483 (type: zip-code, confidence: 0.50)
- r.okafor@example.net (type: email-address, confidence: 0.90)
- 1HGCM82633A004352 (type: vin, confidence: 0.90)
- VIN (type: first-name, confidence: 1.00)
- lot (type: first-name, confidence: 1.00)
...
PII found in onboarding-checklist.md:
- md (type: state-abbreviation, confidence: 0.25)
- 01/05/2027 (type: date, confidence: 0.75)
- new.hire@example.org (type: email-address, confidence: 0.90)
- 021000021 (type: bank-routing-number, confidence: 0.95)
- zip-code matched the five-digit claim numbers (
10482,10483). No file in the share contains a ZIP code. - first-name matched common words that are also in the first-name dictionary:
VIN,lot, andsole. - state-abbreviation matched
md, the extension inonboarding-checklist.md. Phinder scans each file’s name along with its contents.
A starter policy enables these types the same way as the real ones, so applied unchanged, it would redact claim numbers and ordinary words.
3. Tune the policy
Decide for each type whether to keep it, adjust it, or replace it. For this share:
- Drop
stateAbbreviation. The only match was a file extension, and no file names go through Philter. - Replace
firstNamewith Philter’s PhEye person-name filter, which judges names from context instead of a dictionary. Copy it from Philter’s built-indefaultpolicy. - Keep
zipCode, since ZIP codes are a HIPAA Safe Harbor identifier, but turn onvalidate, which checks the first five digits against the US Census list of ZIP codes. In this test it dropped the claim numbers, and in a separate check it kept a real ZIP code.
jq '.identifiers |= (del(.stateAbbreviation, .firstName) | .zipCode.validate = true)' \
starter-policy.json > tuned-policy.json
curl -sk "https://localhost:8080/api/policies/default" \
-H "Authorization: Bearer $PHILTER_API_KEY" | jq '.identifiers.person' > person.json
jq --slurpfile p person.json '.identifiers.person = $p[0]' tuned-policy.json > t.json \
&& mv t.json tuned-policy.json
jq '.identifiers | keys' tuned-policy.json
[
"bankRoutingNumber",
"date",
"emailAddress",
"person",
"phoneNumber",
"ssn",
"vin",
"zipCode"
]
ZIP code validation has a cost: a valid ZIP code missing from the Census list is not redacted. Use it where the false positives matter more than that risk, and confirm the trade-off on your own data.
4. Load it into Philter
curl -sk -X POST "https://localhost:8080/api/policies?name=claims-share" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @tuned-policy.json -w "%{http_code}\n"
201
To change it later, send the new version with PUT /api/policies/claims-share, which keeps the earlier one as a revision.
5. Redact and compare
Redact one of the claim notes with the tuned policy:
curl -sk "https://localhost:8080/api/filter?p=claims-share" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @/mnt/claims-share/claims/claim-10482.txt
Claim 10482
Claimant email: {{{REDACTED-email-address}}}
Callback number: {{{REDACTED-phone-number}}}
Notes: Claimant reported water damage on {{{REDACTED-date}}}. Policyholder SSN {{{REDACTED-ssn}}} on file.
Loaded the same way under the name starter, the untuned starter-policy.json redacts the claim number in the first line as {{{REDACTED-zip-code}}}. The difference is clearer on a sentence with a name in it:
for p in starter claims-share; do
curl -sk "https://localhost:8080/api/filter?p=$p" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary "Adjuster Dana Whitfield inspected the VIN at the lot."
echo
done
Adjuster {{{REDACTED-first-name}}} {{{REDACTED-first-name}}} inspected the {{{REDACTED-first-name}}} at the {{{REDACTED-first-name}}}.
Adjuster {{{REDACTED-name}}} inspected the VIN at the lot.
The first request after Philter starts loads the name model and takes a few seconds.
Writing the policy as PhiSQL
Give the output file a .phisql extension to get the policy as PhiSQL instead:
java -jar phinder.jar -i /mnt/claims-share -R --emit-policy starter-policy.phisql > /dev/null 2>&1
cat starter-policy.phisql
REDACT BANK_ROUTING_NUMBER WITH REDACT;
REDACT DATE WITH REDACT;
REDACT EMAIL_ADDRESS WITH REDACT;
REDACT FIRST_NAME WITH REDACT;
REDACT PHONE_NUMBER WITH REDACT;
REDACT SSN WITH REDACT;
REDACT STATE_ABBREVIATION WITH REDACT;
REDACT VIN WITH REDACT;
REDACT ZIP_CODE WITH REDACT;
One statement per type is easier to review and edit than the JSON. Phinder checks that the PhiSQL compiles before it writes the file. Philter compiles it with POST /api/policies/compile, which returns the policy without saving it, so save the result in a second request:
curl -sk -X POST "https://localhost:8080/api/policies/compile" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @starter-policy.phisql | jq '.policy' > from-phisql.json
curl -sk -X POST "https://localhost:8080/api/policies?name=claims-share-phisql" \
-H "Authorization: Bearer $PHILTER_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @from-phisql.json -w "%{http_code}\n"
201
The same review applies: the PhiSQL enables the same nine types, false positives included.
Next steps
- Label a sample of the share’s documents and score the tuned policy with Philter Scope before you rely on it.
- If the share keeps changing, rescan it incrementally and regenerate the starter policy when the scan finds a type the policy does not cover.
- Delete
console.txtonce you have reviewed it. It lists every value the scan detected.