Lion Cipher Lab

Build a DLP guard for LLM outputs — catch PII and secret leakage before it reaches the user, and measure it

Why it matters

An LLM app leaks sensitive data through its RESPONSES: a customer's email or card number pulled from context, an API key echoed back from a config file, another tenant's record surfaced by a RAG retrieval. Telling the model "don't reveal secrets" is not a control — the model is non-deterministic and can be injected into ignoring the instruction. The real control is a deterministic scanner that inspects every response BEFORE it reaches the user and blocks or redacts leaks. This is OWASP LLM02:2025 Sensitive Information Disclosure. Anyone can bolt on a regex; the job is to prove it works — so…

What you'll learn

Steps in this lab

  1. The threat: your model answers, and the answer contains a secret
  2. Set up a scratch folder
  3. Build the detector: regex + Luhn + Shannon entropy + allowlist
  4. Build a labeled corpus — including deliberate near-misses
  5. Measure it — read the confusion matrix
  6. Read the tuned numbers — what each knob bought you
  7. Redact and fail closed — turning detection into a control
  8. Judgment: the ceiling, when to escalate, and defense-in-depth

Open the full interactive lab →