feat: log bundle export with PII sanitization option #51

Closed
opened 2026-05-26 23:05:28 -07:00 by pyr0ball · 1 comment
Owner

The Bundles view currently exports raw log entries. For enterprise or support contexts, operators need to share bundles with third parties (vendors, support teams) with sensitive fields redacted.

Features:

  • REDACT_FIELDS config: list of regex patterns to scrub from MESSAGE field before export (e.g. IP addresses, hostnames, usernames)
  • Per-bundle redaction flag: export UI checkbox "Sanitize PII before export"
  • Preview mode: show first 5 entries with redaction applied before committing the export
  • Audit trail: exported bundle metadata logged with redaction flag and timestamp

Default redaction patterns (opt-in):

  • IPv4 addresses
  • Hostnames matching a configurable domain suffix
  • Username fields in auth log entries

Acceptance criteria:

  • Exported JSONL with redaction enabled has no raw IP addresses matching the configured patterns
  • Preview mode works in UI before download
  • Redaction config can be disabled (empty list) for full-fidelity exports
The Bundles view currently exports raw log entries. For enterprise or support contexts, operators need to share bundles with third parties (vendors, support teams) with sensitive fields redacted. **Features:** - `REDACT_FIELDS` config: list of regex patterns to scrub from `MESSAGE` field before export (e.g. IP addresses, hostnames, usernames) - Per-bundle redaction flag: export UI checkbox "Sanitize PII before export" - Preview mode: show first 5 entries with redaction applied before committing the export - Audit trail: exported bundle metadata logged with redaction flag and timestamp **Default redaction patterns (opt-in):** - IPv4 addresses - Hostnames matching a configurable domain suffix - Username fields in auth log entries **Acceptance criteria:** - Exported JSONL with redaction enabled has no raw IP addresses matching the configured patterns - Preview mode works in UI before download - Redaction config can be disabled (empty list) for full-fidelity exports
pyr0ball added this to the beta milestone 2026-05-26 23:05:28 -07:00
pyr0ball added the
ux
enhancement
security
compliance
labels 2026-05-26 23:05:28 -07:00
Author
Owner

Implemented:

  • _redact_text() in incidents.py with 5 compiled regex patterns (IPv4, email, user=, host=, password=)
  • build_bundle(sanitize=False) — opt-in redaction applied per log entry text
  • sent_bundles SQLite table (schema in pipeline.py, auto-created on startup)
  • record_sent_bundle() called on every bundle GET and every bundle send
  • list_sent_bundles() exposed at GET /api/sent-bundles
  • POST /api/incidents/{id}/send?sanitize=true passes flag through
  • GET /api/incidents/{id}/bundle?sanitize=true records export + applies redaction
  • BundlesView: Received / Sent tabs; Sent tab shows sanitized badge, 5-entry preview, re-download button
  • IncidentsView: "Sanitize PII" checkbox next to Send Bundle button
  • 372 tests passing, frontend build clean

Compliance note: GDPR anonymization disclaimer is in docs/compliance/checklist.md — anonymized bundles cannot be selectively deleted post-export.

Implemented: - `_redact_text()` in `incidents.py` with 5 compiled regex patterns (IPv4, email, user=, host=, password=) - `build_bundle(sanitize=False)` — opt-in redaction applied per log entry text - `sent_bundles` SQLite table (schema in `pipeline.py`, auto-created on startup) - `record_sent_bundle()` called on every bundle GET and every bundle send - `list_sent_bundles()` exposed at `GET /api/sent-bundles` - `POST /api/incidents/{id}/send?sanitize=true` passes flag through - `GET /api/incidents/{id}/bundle?sanitize=true` records export + applies redaction - BundlesView: Received / Sent tabs; Sent tab shows sanitized badge, 5-entry preview, re-download button - IncidentsView: "Sanitize PII" checkbox next to Send Bundle button - 372 tests passing, frontend build clean Compliance note: GDPR anonymization disclaimer is in `docs/compliance/checklist.md` — anonymized bundles cannot be selectively deleted post-export.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/turnstone#51
No description provided.