Skip to content

Improvement: enabling PII protection does nothing until patterns are hand-checked — seed the universal detection patterns on enable #2656

Closed

Description

@yannickmonney

Problem

Turning on Governance → Guardrails → PII protection ships with zero detection patterns enabled, so the feature is a silent no-op until the admin manually checks boxes. An admin who flips the switch expecting "PII is now protected" gets nothing — the live preview even says "No detection patterns are enabled. Turn at least one on above to see detections."

Unlike the sibling guardrail layers, PII patterns are universal and safe to preconfigure: email, phone, credit card, SSN, IBAN, etc. are the same for every org. (Content-safety word lists and the moderation endpoint genuinely can't be guessed — those shipping empty is defensible; PII is the one clear preconfigure win.) This is exactly the "preconfigure sensible defaults to make life easier" pattern.

Current behaviour

Repro (2026-07-11, main @ 94ef84e): Settings → Governance → Guardrails → toggle Enable PII protection on. The revealed config shows 12 detection patterns (Email, Phone, Credit card, Card CVC, IBAN, IP, MAC, JWT, SSN, DOB, Address, National ID) all unchecked; mode defaults to Tokenize; autosaves. Verified the persisted config:

// tests/e2e/fixtures/config/<org>/governance/pii-config.json  (after enable)
{ "enabled": true, "mode": "tokenize", "enabledPatterns": [], "customPatterns": [] }

Ground truth default: builtin-configs/governance/pii-config.json → { "enabled": false, "mode": "mask", "enabledPatterns": [] }.

(Minor, same area: the builtin default mode is "mask" but the UI writes "tokenize" on first enable — worth aligning.)

Code pointers

  • builtin-configs/governance/pii-config.json — enabledPatterns: []
  • lib/shared/schemas/governance.ts — PII config schema/defaults
  • app/features/settings/.../guardrails PII section (the enable handler that writes the config)

Proposed change

On first enable (empty enabledPatterns), seed the common set — email, phone, credit_card, card_cvc, iban, ssn, national_id — so the toggle protects something immediately; the admin can prune. Reconcile the enable-time mode default with the builtin (mask).

Acceptance criteria

  • Enabling PII protection activates a sensible default pattern set (not empty)
  • Enable-time mode matches the documented default
  • Admin can still deselect any pattern; existing configured orgs are untouched

Related: the content-safety and moderation layers also enable inert, but those are org-specific / need an endpoint — out of scope here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions