Skip to content

PII Airlock & Receipts

The PII airlock turns an HTTP response into a safe copy: personal data becomes deterministic synthetic values, credentials are stripped, and tracked secrets become placeholders. Every safe copy comes with a compliance receipt that records what was masked and whether any original value survived. Use it whenever response data goes to an AI agent, a screen share or a shared report.

In a demo workspace, start the sandbox with recon ui and send the student list through the airlock:

Terminal window
recon init --demo
recon send "List Students" --airlock
GET http://127.0.0.1:4210/_sandbox/local/v1/students 200 5.1ms 669B -> 669B (HTTP/1.1)
✓ status == 200
✓ jsonpath $.students[0].program == MDiv
{
"environment": "local",
"request_id": "req_fc800e5ee577466f845f2d0e217d06f9",
"session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdGFmZl8wMSIsInNjb3BlIjoic2lzOnJlYWQiLCJleHAiOjE4OTM0NTYwMDB9.demo_sig",
"students": [
{
"email": "micah.vaughn.9383@example.edu",
"full_name": "Eli Bennett",
"gpa": 3.92,
"notes": "Advisor note: email micah.vaughn.9383@example.edu before Friday",
"phone": "(555) 190-8612",
"program": "MDiv",
"ssn": "923-95-3372",
"student_id": "007218"
},
...
]
}

The sandbox returned elena.original@westminster.edu, 123-45-6789 and 001001. The same email in the notes free text became the same synthetic address as the email field. The session_token JWT was not changed: the airlock only masks what its rules and detectors recognise (see Limits).

With --format json the output also carries the receipt:

"compliance_receipt": {
"fields_masked": 11,
"headers_stripped": 0,
"leaked_tokens_found": [],
"receipt_hash": "a188879d19057321ddb1b144970682f92ffa1dc27107363dd20f5184988ffb77",
"salt_fingerprint": "9d2de0d49b08",
"secrets_scrubbed": 0,
"verified_zero_leak": true
},

The airlock does not change what is stored. The Flight Recorder keeps the raw response body and headers in .recon/flight.db; the airlock is applied when data leaves for an agent or a display, and the receipt is stored next to each run.

Surface Behaviour
recon send Receipt always computed and stored. The printed body is the airlocked one with --airlock, with --format agent, and with --format auto when stdout is not a terminal. In human mode the receipt itself is not printed; use --format json.
recon test Receipt computed per case and stored. The JUnit report adds airlock.verified, airlock.fields_masked and airlock.secrets_scrubbed properties; the Markdown summary adds an Airlock column.
recon twin No airlock.
recon mock, recon paginate, recon sse, recon ws, recon graphql, recon grpc Off by default; pass --airlock.
recon export openapi Response examples airlocked by default; --no-airlock turns it off.
recon capsule export Always airlocked. Export fails if the zero-leak check fails on the response or the request.
recon proxy capture, flows Receipt computed and stored with each recorded run.
MCP tools Always. Every response body, header set, script log and captured variable returned to the agent is airlocked, and airlock is forced on for SSE, WebSocket, GraphQL, gRPC, pagination, mock export and OpenAPI export. Runs read back from history are airlocked before they are returned.
Web studio The send response and GET /api/v1/runs/{id} return the raw run and an airlock copy side by side.

The airlock reads an optional TOML file. Its path comes from the mask_config key in .recon.toml, relative to the workspace root:

mask_config = "mask.toml"
  • recon init --demo sets mask_config = "mask.toml" and writes a sample file.
  • recon init without --demo does not write the key. With no mask_config key, no mask file is read, even if mask.toml exists.
  • A directory with no .recon.toml at all uses mask.toml.
  • The file is read once when a command, recon ui or recon mcp starts. Saving from the web studio hot-reloads it in that server.
email_domain = "example.edu"
date_shift_days = 30
[columns]
email = "email"
full_name = "name"
student_id = "id"
[tables."List Students"]
nickname = "first_name"
[[custom_rules]]
name = "badge"
pattern = "BADGE-[0-9]{6}"
replacement = "[REDACTED:BADGE]"
description = "Campus badge numbers"
Key Type Default Meaning
email_domain string example.edu Domain for synthetic emails.
date_shift_days integer 30 Maximum shift, in days either way, for date_shift. Values below 1 are treated as 1.
columns table of field name to strategy empty Rules for any field with that name.
tables.<name> table of field name to strategy empty Rules that apply only when the response belongs to a request named <name>.
custom_rules array of tables empty Regex rules applied to every header value, JSON string and text body.

Field names in columns and tables match case-insensitively. A tables key matches the request name (case-insensitive) or the part of it after the last .. A tables rule wins over a columns rule for the same field.

[[custom_rules]] fields:

Field Required Default Meaning
name yes Rule name. Recorded as custom_regex:<name>.
pattern yes Rust regex syntax.
replacement no [REDACTED] Replacement text.
description no none Free text, shown in the audit report.

Validation rejects a rule with an empty name, an empty pattern or a pattern that does not compile:

mask config error at `mask.toml`: custom rule `name` cannot be empty
mask config error at `mask.toml`: invalid regex in custom rule `broken`: regex parse error: ...

A strategy name can be used in columns and tables. All synthetic values are derived from an HMAC of the trimmed input (see Determinism and the salt), so the same input always gives the same output.

Strategy Output Example output
name First name and last name from built-in lists of 64 each Eli Bennett
first_name A first name Peter
last_name A last name Irving
email first.last.NNNN@<email_domain>. The input is lowercased first, so case does not change the result. miriam.aldridge.3162@example.edu
phone (555) 1XX-XXXX (555) 155-0965
ssn 9XX-XX-XXXX, with the first group 900 to 998 923-95-3372
id All-digit input: same length, leading zeros kept, never equal to the input. Other input: each ASCII digit, uppercase and lowercase letter replaced by one of the same class; other characters kept. 001001 becomes 007218; A-12b becomes I-59k
int_id Digits of the number with leading zeros removed. Non-numeric input becomes a number from 100000 to 899999999. 1001 becomes 7218
address <100-9899> <street> from 16 built-in street names 9256 Elmhurst Pl
date_shift If the value starts with YYYY-MM-DD, the date is moved by a per-value offset between -date_shift_days and +date_shift_days (never 0) and the rest of the string is kept. Otherwise 1990-01-DD. 2001-04-12 becomes 2001-03-17
ip 198.51.100.N, N from 1 to 253 198.51.100.151
hash h_ followed by 16 hex characters h_ad406eb868c27964
text_redact The value with embedded emails, SSNs, phone numbers and IPv4 addresses replaced, in that order, using the strategies above Reach ada.lovelace@real-school.edu or 503-555-9912 becomes Reach ruby.jennings.8005@example.edu or (555) 155-0965
redact [REDACTED]
null JSON null
keep The value unchanged

Empty strings stay empty for the HMAC-based strategies. Any other name, for example drop, is rejected when the config is parsed.

The airlock walks the response as follows.

Headers. A header named authorization, proxy-authorization, set-cookie, cookie, x-api-key, x-auth-token or x-csrf-token (any case) has its value replaced with [AIRLOCK:STRIPPED]. For every other header, tracked secrets are replaced with [SECRET:<label>], then custom rules run, then text_redact.

JSON bodies. Tracked secrets are replaced first. Then, for every value, using the nearest object key as the field name (array elements use their parent’s key):

  • Strings. Use the configured rule for the field. If none, use automatic detection on the field name and this one value. If that finds nothing, use text_redact. Custom rules run before the strategy.
  • Integers. Masked only when the field resolves to id or int_id, by configuration or detection. The sign is kept.
  • Floats, booleans and null. Unchanged.

The result is re-serialized as pretty-printed JSON with keys in alphabetical order.

Other bodies. Tracked secrets are replaced, then custom rules run, then text_redact runs over the whole text.

When no rule is configured, the field name and value are checked in this order. The first match wins.

Check Strategy
Value is an email address email
Value is NNN-NN-NNNN ssn
Value is a US phone number phone
Value is a dotted IPv4 address ip
Name contains ssn or social_security, or is tax_id ssn
Name contains email (or is e_mail) and does not end in _id email
Name contains phone, mobile or tel_, or is cell, and does not end in _id phone
Name is first_name, fname, given_name or ends in _first_name first_name
Name is last_name, lname, surname, family_name or ends in _last_name last_name
Name is full_name, student_name, sortable_name, short_name, display_name, legal_name, preferred_name or instructor_name name
Name is dob or contains birth_date, birthdate or date_of_birth date_shift
Name contains street or home_address, or is address, address1 or address_line_1 address
Name is sis_user_id, person_id, student_id, populi_id, unique_id or login_id int_id for integers, id for strings
Name contains ip_address, or is client_ip or remote_ip ip
Value contains an email, SSN or phone number text_redact

Name checks are case-insensitive.

Each [[custom_rules]] entry runs in file order against header values, each JSON string and plain-text bodies. Every match is replaced with replacement and recorded as custom_regex:<name> in the masked paths. Matched values of 4 or more characters are added to the zero-leak check. Custom rules run before the built-in strategy for the same value.

Every synthetic value is an HMAC-SHA256 keyed with the salt over a strategy tag and the input. The same salt and input always produce the same output, across requests, commands and machines, so joins on masked IDs still line up. A different salt changes every synthetic value.

The salt comes from the global --salt flag or the MASKKEEL_SALT environment variable. When neither is set, the default recon-dev-salt is used. If MASKKEEL_SALT is set to an empty string, the salt is empty; it does not fall back to the default.

Terminal window
recon airlock verify # Airlock Salt Fingerprint: 9d2de0d49b08
MASKKEEL_SALT=team-secret recon airlock verify # Airlock Salt Fingerprint: 243b89ee7724

The salt fingerprint is the first 6 bytes, in hex, of HMAC-SHA256(salt, "salt_fingerprint:maskkeel-v2"). It identifies the salt without revealing it. You can check it with Python:

Terminal window
python3 -c 'import hmac,hashlib; print(hmac.new(b"recon-dev-salt", b"salt_fingerprint:maskkeel-v2", hashlib.sha256).hexdigest()[:12])'
9d2de0d49b08

The crate’s parity test pins outputs for MASKKEEL_SALT=team-dev-fixture-secret that it states match maskkeel v0.2, for example ada.lovelace@real-school.edu to simon.quincy.0985@example.edu and 001001 to 007695.

Inside one recon mcp session, every value masked with id or int_id is remembered as a synthetic-to-real pair. When the agent later calls recon_send_request with a URL or a JSON or text body that contains a synthetic ID, Recon replaces it with the real one before sending. The agent only ever sees the synthetic value.

For example, an agent that called recon_send_request with ?student=007218 produced a Flight Recorder run whose URL ends in ?student=001001.

The map lives in memory for the life of the recon mcp process, holds up to 10,000 pairs, and drops the oldest pair when full. The translation is applied to any target host whenever the map is not empty.

After masking, the airlock searches the output headers and body for any original value it saw:

  • emails, SSNs and phone numbers found anywhere in the raw body;
  • raw strings that were masked with email, ssn, phone, name, first_name or last_name;
  • every custom-rule match;
  • every tracked secret, and its Base64 form.

The search is case-insensitive and skips values shorter than 4 characters after trimming. Anything found is listed in leaked_tokens_found and verified_zero_leak is false.

  • The check only covers values in the list above. Tokens, JWTs, free-text names and other identifiers that no rule or detector matched pass through unchanged and are not reported.
  • IPv4 addresses and values masked with id, int_id, address, date_shift or hash are masked but not part of the leak check.
Field Meaning
salt_fingerprint Fingerprint of the active salt.
fields_masked Number of entries in masked_paths (headers stripped, values masked, custom-rule hits).
secrets_scrubbed Number of tracked secret occurrences replaced.
headers_stripped Number of sensitive headers replaced with [AIRLOCK:STRIPPED].
verified_zero_leak true when leaked_tokens_found is empty.
leaked_tokens_found Original values found in the output.
receipt_hash SHA-256, hex.

masked_paths entries have a path (header:<name>, $ for a whole text body, or a JSON path such as $.students[0].email) and a strategy (a strategy name, header_strip or custom_regex:<name>). One path can appear twice, for example once for a custom rule and once for text_redact.

The receipt hash is SHA-256 over this byte string:

recon-airlock-v1:<salt_fingerprint>:<fields_masked>:<secrets_scrubbed>:<headers_stripped>:<true|false>:<airlocked body>

You can recompute it from an airlock result. TOKEN is the content of the recon-token meta tag in the page that recon ui serves. This preview sends a Set-Cookie, an X-Api-Key and an X-Contact header plus a text body:

Terminal window
curl -s -X POST http://127.0.0.1:4210/api/v1/airlock/preview \
-H "X-Recon-Token: $TOKEN" -H 'content-type: application/json' \
-d '{"headers":[["Set-Cookie","sid=abc123"],["X-Api-Key","k-998877"],["X-Contact","ada.lovelace@real-school.edu"]],"body":"Reach ada.lovelace@real-school.edu or 503-555-9912 from 10.0.4.25, SSN 123-45-6789"}'
{
"airlock": {
"body": "Reach ruby.jennings.8005@example.edu or (555) 155-0965 from 198.51.100.151, SSN 923-95-3372",
"headers": [
{ "name": "Set-Cookie", "value": "[AIRLOCK:STRIPPED]" },
{ "name": "X-Api-Key", "value": "[AIRLOCK:STRIPPED]" },
{ "name": "X-Contact", "value": "ruby.jennings.8005@example.edu" }
],
"masked_paths": [
{ "path": "header:set-cookie", "strategy": "header_strip" },
{ "path": "header:x-api-key", "strategy": "header_strip" },
{ "path": "header:x-contact", "strategy": "text_redact" },
{ "path": "$", "strategy": "text_redact" }
],
"receipt": {
"fields_masked": 4,
"headers_stripped": 2,
"leaked_tokens_found": [],
"receipt_hash": "c76413a07e8a99520a4448583a8088a721e6f213be858b335c62cbfaef73ec48",
"salt_fingerprint": "9d2de0d49b08",
"secrets_scrubbed": 0,
"verified_zero_leak": true
}
}
}
Terminal window
python3 -c '
import hashlib
body="Reach ruby.jennings.8005@example.edu or (555) 155-0965 from 198.51.100.151, SSN 923-95-3372"
print(hashlib.sha256(("recon-airlock-v1:9d2de0d49b08:4:0:2:true:"+body).encode()).hexdigest())'
c76413a07e8a99520a4448583a8088a721e6f213be858b335c62cbfaef73ec48

This matched the receipt_hash the server returned. The Flight Recorder includes each run’s receipt_hash in its hash chain; see Flight Recorder.

Verifies the Flight Recorder hash chain and prints the active salt fingerprint. It has no options of its own; the global --workspace, --format and --salt apply.

Terminal window
recon airlock verify
Airlock Salt Fingerprint: 9d2de0d49b08
Flight Ledger: VALID (12 entries, head 84e9cc9b42b293ae2bdea5197275bd4fc9b2aeea3fd3743b36b68942f3178acf)
Terminal window
recon airlock verify --format json
{
"ledger": {
"first_broken_id": null,
"head_hash": "84e9cc9b42b293ae2bdea5197275bd4fc9b2aeea3fd3743b36b68942f3178acf",
"total_entries": 12,
"valid": true
},
"salt_fingerprint": "9d2de0d49b08"
}

It exits 0 when the chain is valid and 1 when it is not (printed as TAMPERED, with first_broken_id set).

Builds a compliance audit bundle from the most recent runs and agent activity. The bundle contains receipt counts, hashes and metadata only, never response bodies.

Terminal window
recon airlock audit --html audit/report.html --json audit/bundle.json --limit 2
Airlock Compliance Audit: 2 runs (2 zero-leak verified), 22 masked fields, 0 agent events
HTML report: audit/report.html
JSON bundle: audit/bundle.json
Flag Default Meaning
--html <PATH> none Write a single self-contained HTML report. Parent directories are created.
--json <PATH> none Write the bundle as pretty JSON. Parent directories are created.
--limit <N> 100 Number of recent runs, and of recent agent activity rows, to include. Clamped to 1 to 500.

Without --html or --json nothing is written to disk. With --format json or --format agent the full bundle is printed to stdout. The command exits 0.

Field Meaning
generated_at_utc RFC 3339 timestamp.
workspace_name name from .recon.toml.
salt_fingerprint Active salt fingerprint.
mask_config The loaded mask configuration, including custom rules.
runs_total, zero_leak_verified_runs Count of runs, and of runs whose receipt verified.
total_fields_masked, total_secrets_scrubbed, total_headers_stripped Sums over the included runs.
recent_runs Per run: id, ts_utc, actor (human, agent or cli), request_name, env_name, method, url, status, receipt_hash, fields_masked, secrets_scrubbed, headers_stripped, verified_zero_leak.
recent_agent_activity Per MCP event: ts_utc, tool_name, request_name, method, env_name, decision, reason, airlock_redactions.

The report is titled Recon Compliance Audit — <workspace> and has summary cards (Runs Audited, Zero-Leak Verified, PII Fields Masked, Secrets Scrubbed, Headers Stripped, Custom Regex Rules) and three tables: Configured Custom Regex Rules, Flight Compliance Receipts (with PASS or LEAK and the first 16 characters of each receipt hash) and MCP Agent Governance Activity. All values are HTML-escaped and the page loads no external resources.

Situation Result
Invalid mask.toml Ignored by CLI, recon ui and recon mcp; reported by recon doctor.
Invalid config sent to POST /api/v1/airlock/config or /api/v1/airlock/rule-preview HTTP 400, E_BAD_REQUEST with the validation message.
Unknown strategy name in a JSON config body HTTP 422 from request body parsing.
Ledger broken recon airlock verify exits 1.
  • MCP: recon_verify_airlock returns the same data as recon airlock verify. The resource recon://airlock/config returns the salt fingerprint and loaded config. See MCP Tools.
  • HTTP: GET /api/v1/airlock/config, POST /api/v1/airlock/config (validate, save and hot-reload), POST /api/v1/airlock/rule-preview (test a config against a sample), POST /api/v1/airlock/preview (airlock arbitrary headers and body), GET /api/v1/airlock/audit?format=html|json&download=1&limit=N, GET /api/v1/runs/{id}/airlock, GET /api/v1/ledger/verify. POST routes need the X-Recon-Token header. See HTTP API.
  • Web studio: the response Airlock view shows the receipt, the salt fingerprint, up to six masked paths and the airlocked body. Its Rule Studio & Audit button, or the command palette entry Open Airlock Rule Studio & Compliance Audit, opens an editor for email_domain, date_shift_days, custom rules and column rules, with a Test Rules preview and Export HTML Audit / JSON Audit downloads. The editor has no controls for tables rules, and its strategy menu offers drop, which the server rejects on save. See Web Studio.