Credential Protection
Credential Protection (/reversible-redaction) intercepts recognized secrets in outbound model requests, replaces them with reversible placeholders, and restores them in model responses before returning output to your client.

Prerequisites
- Clear threat-model understanding: Credential Protection stops supported secrets from leaving your Stravia instance to upstream providers—it does not encrypt your database/Redis or stop non-secret prompt text from going upstream.
Steps
Enable Credential Protection
Open Advanced Features → Credential Protection (active tab persists via
?tab=records|rules|test) and turn on the global Credential Protection switch (reversible_redaction_enabled).Manage the 461 bundled rules and custom rules
- Bundled catalog: Stravia ships 461 active Betterleaks rules running strictly offline inside your gateway (no network verification calls). (Legacy Kingfisher rules were removed; formats matched only by Kingfisher require a custom rule.)
- Disable individual rules: Toggle off any bundled rule (
reversible_redaction_disabled_rules) to stop new detections under that rule without revoking placeholder restoration for existing valid mappings. - Add custom rules: Create pattern-based custom rules with independent
enabledswitches, and use the built-in test box to test patterns locally without saving input text or touching the mapping dictionary.
Review hit discoveries and reveal controls
- Default masking: In Hit records, matched spans render masked as
••••••(6bullets) by default. - Explicit reveal: Viewing plaintext requires requesting reveal (
?reveal=true) as an authenticatedadminsession (403 credential_reveal_forbiddenotherwise). - Logs vs. hit records: In Request history (
/logs), active redactions render as***on read—until the mapping expires or is cleaned up.
- Default masking: In Hit records, matched spans render masked as
Understand mapping expiration and database/Redis boundaries
- Expiration: Mappings expire based on
last_detected_atrelative tolog_retention_days(default7days) plus a1-hour renewal granularity (last_detected_at <= now - N - 1h). Real rule detections renew mappings; simply viewing masked logs in/logsdoes not. Once expired, Stravia stops redacting that secret on outbound calls, though retained history entries can still restore placeholders until swept. - Plaintext storage boundary:
reversible_redaction_mappings.secretstores reversible plaintext secrets in SQLite/PostgreSQL. When running PostgreSQL, cached mapping snapshots also enter Redis (RuntimeCache). Treat your database, backups, and Redis (network isolation, ACLs, TLS) as secret storage.
- Expiration: Mappings expire based on
Verify
Send a request containing a synthetic test secret matching an enabled rule (never use a live production credential for testing) and verify:
- Credential Protection → Discoveries records the match masked as
••••••. - Request history (
/logs) displays***rather than the raw test secret.
Troubleshooting
- Old masked markers in
/logsappear literally after upgrading to v0.7.5: Migration0055permanently removed legacy mappings that had empty attribution or only retired rules; those old placeholders pass through literally. - Disabled rule still restores an older conversation: Disabling a rule stops new detections only; existing active mappings remain restorable until they expire.
Next
- Databases, Storage & Backups — secure SQLite backups, PostgreSQL, and Redis.
- Security, Upgrades & Recovery — review instance secret boundaries and migration
0055.