Skip to content

Project 6 PII Guardrail

Huzefaaa2 edited this page Jan 26, 2026 · 3 revisions

Project 6 – PII Guardrail Pre‑Ingest

PII Guardrail redacts sensitive data before logs and traces enter observability pipelines. It ships with regex‑based detection, credit‑card validation, and a CLI for batch scrubbing.

Architecture

flowchart LR
  Logs[Logs/Traces] --> Scrubber[PII Scrubber]
  Scrubber --> Redacted[Redacted Output]
  Scrubber --> Report[Redaction Report]
Loading

What’s implemented

  • Email, SSN, phone, IPv4, credit‑card, and API‑key detection.
  • Recursive scrubbing for JSON logs, JSONL, raw text, and OTLP‑style traces.
  • Redaction reports (counts by label).
  • Configurable labels and redaction token.

Quickstart

PYTHONPATH=projects/pii-guardrail/src python3 -m pii_guardrail.cli \
  --input projects/pii-guardrail/examples/sample_logs.jsonl \
  --format jsonl \
  --output out_logs.jsonl \
  --report redaction_report.json

Scrub a trace JSON:

PYTHONPATH=projects/pii-guardrail/src python3 -m pii_guardrail.cli \
  --input projects/pii-guardrail/examples/sample_trace.json \
  --format trace \
  --output out_trace.json

Key files

  • projects/pii-guardrail/src/pii_guardrail/scrubber.py
  • projects/pii-guardrail/src/pii_guardrail/patterns.py
  • projects/pii-guardrail/src/pii_guardrail/cli.py

Clone this wiki locally