You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom regex patterns are already supported in the backend config (regex_config.custom_patterns in src/backend/config/pii_detector_config.json), but they can only be configured by editing the JSON file on the server. End users have no way to add domain-specific patterns (employee IDs, internal ticket IDs, project codes, etc.) without filing a request or editing config directly.
We should expose custom regex management through the extension UI so users can add their own patterns at runtime.
Proposal
Add a "Custom patterns" section to the extension options page that lets users define and manage their own regex-based detectors.
UI
Table of custom patterns with columns: Label, Pattern, Enabled, Actions (edit / delete).
"Add pattern" form with:
Label (e.g., EMPLOYEE_ID) — uppercase, used as the entity type name.
Regex pattern (e.g., \\bEMP-\\d{6}\\b).
Optional: replacement/mask format.
Live validation: compile the regex client-side and reject invalid patterns before saving.
Preview field: paste sample text, see what matches before saving.
Backend
Endpoint to GET/PUT user-defined patterns, merged with regex_config.custom_patterns from the static config.
Server-side regex compilation + validation (reject patterns that fail to compile or are catastrophically slow — use Go's regexp which is RE2 and safe from ReDoS, but still cap pattern length).
Motivation
Custom regex patterns are already supported in the backend config (
regex_config.custom_patternsinsrc/backend/config/pii_detector_config.json), but they can only be configured by editing the JSON file on the server. End users have no way to add domain-specific patterns (employee IDs, internal ticket IDs, project codes, etc.) without filing a request or editing config directly.We should expose custom regex management through the extension UI so users can add their own patterns at runtime.
Proposal
Add a "Custom patterns" section to the extension options page that lets users define and manage their own regex-based detectors.
UI
EMPLOYEE_ID) — uppercase, used as the entity type name.\\bEMP-\\d{6}\\b).Backend
regex_config.custom_patternsfrom the static config.regexpwhich is RE2 and safe from ReDoS, but still cap pattern length).Persistence
Acceptance criteria
Related
src/backend/config/README.md("Custom Patterns" section)