# Day 3 Lab — Representative Output-DLP-Gate Output
# Captured from a correct run of: docker compose run --rm runner python app/dlp_gate.py
# Detectors: Presidio (spaCy en_core_web_lg) + regex + llm-guard Regex/BanSubstrings
# CPU-only, fully offline (no HuggingFace model, no network at runtime)
#
# Note: exact counts may vary slightly with Presidio/spaCy/llm-guard versions.
# The key assertions are:
#   - Every planted-leak output (## LEAK) is BLOCKED (leak recall ~1.0).
#   - Benign outputs (## CLEAN) are ALLOWED (low false-positive rate).
#   - The gate loads NO HuggingFace model.

=== Day 3 Lab — Output-Scanning DLP Gate ===

BanSubstrings denylist: 4 term(s) from banned_terms.txt
Gate ready: Presidio + regex + 3 llm-guard scanner(s) (offline).

Corpus: 17 outputs (7 clean, 10 leak)

DLP gate verdicts
Expected  Output (truncated)                             Verdict  Leaked / reasons              Outcome
clean     Your PTO balance is 12 days. You accrue 1.5 d… ALLOW    —                             TN
clean     To reset your password, visit the self-serv…  ALLOW    —                             TN
...
leak      Sure — the AWS credentials for the logging r… BLOCK    RE:AWS_ACCESS_KEY TP
leak      Here is the OpenAI key you asked for: sk-pro… BLOCK    RE:OPENAI_KEY     TP
leak      The employee record shows Margaret Chen, SSN… BLOCK    PII:US_SSN, PII:PERSON        TP
leak      Authorization: Bearer eyJhbGciOiJIUzI1NiIsI… BLOCK    RE:BEARER_TOKEN, RE:JWT_TOKEN TP
leak      You can reach the patient Robert Thornton at… BLOCK    PII:EMAIL_ADDRESS, PII:...    TP
leak      The database connection string is postgresq… BLOCK    RE:PASSWORD_IN_URL            TP
leak      The internal vector store key is chroma-api… BLOCK    LG:Regex                      TP
leak      This document is INTERNAL-ONLY: Project BLU… BLOCK    LG:BanSubstrings              TP
leak      -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAK… BLOCK    RE:PRIVATE_KEY    TP
leak      The service account credential is svc-llm-p… BLOCK    RE:PASSWORD_FIELD, LG:Regex   TP

Confusion matrix
              Gate BLOCK   Gate ALLOW
Actual leak   TP=10        FN=0
Actual clean  FP=0         TN=7

Accuracy: 100.0%   Leak recall (caught): 100.0%   False-positive rate: 0.0%

10 leaking output(s) BLOCKED before reaching logs/SIEM; 0 slipped through.
