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.

Trust boundary diagram showing what Credential Protection replaces and what plaintext remains stored

Credential Protection page showing rule catalog and demo subset note

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

  1. 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).

  2. 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 enabled switches, and use the built-in test box to test patterns locally without saving input text or touching the mapping dictionary.
  3. Review hit discoveries and reveal controls

    • Default masking: In Hit records, matched spans render masked as •••••• (6 bullets) by default.
    • Explicit reveal: Viewing plaintext requires requesting reveal (?reveal=true) as an authenticated admin session (403 credential_reveal_forbidden otherwise).
    • Logs vs. hit records: In Request history (/logs), active redactions render as *** on read—until the mapping expires or is cleaned up.
  4. Understand mapping expiration and database/Redis boundaries

    • Expiration: Mappings expire based on last_detected_at relative to log_retention_days (default 7 days) plus a 1-hour renewal granularity (last_detected_at <= now - N - 1h). Real rule detections renew mappings; simply viewing masked logs in /logs does 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.secret stores 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.

Verify

Send a request containing a synthetic test secret matching an enabled rule (never use a live production credential for testing) and verify:

  1. Credential Protection → Discoveries records the match masked as ••••••.
  2. Request history (/logs) displays *** rather than the raw test secret.

Troubleshooting

  • Old masked markers in /logs appear literally after upgrading to v0.7.5: Migration 0055 permanently 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