KeyClaw now uses a single in-process engine in src/sensitive.rs to decide what to redact from live traffic.
The runtime has two detector families:
- Opaque tokens: high-entropy credential-like spans. The
opaque tokenclass is the default fallback for random-looking secrets that still need reversible replacement. - Typed structured data:
password,email,phone,national_id,passport,payment_card, andcvv
src/pipeline.rsfinds user-controlled text inside JSON payloads, nested stringified JSON, and supported base64-wrapped content.src/sensitive.rsruns typed structured detectors first.- The opaque-token entropy detector runs next.
- Local allowlists are applied last.
- An optional local classifier can reject ambiguous low-confidence matches, but it is not the primary detector.
KeyClaw rewrites each value into an opaque typed placeholder:
{{KEYCLAW_OPAQUE_<16 hex chars>}}
{{KEYCLAW_EMAIL_<16 hex chars>}}
{{KEYCLAW_PASSWORD_<16 hex chars>}}
The IDs are session-scoped and do not expose prefixes from the original value.
- Edit
src/sensitive.rs. - Add targeted tests:
cargo test placeholder
cargo test --test pipeline
cargo test --test integration_proxy- Update reporting or notices if the new detector changes operator-visible metadata.
- Perfect coverage for every provider or credential format
- Protection for sensitive values that never enter proxied traffic
- Protection if the client bypasses the proxy entirely
For the trust boundary and deployment assumptions, see threat-model.md.