mirror of
https://github.com/karant-dev/AutoRedact.git
synced 2026-04-26 00:05:52 +03:00
[PR #16] [MERGED] Add Custom Redaction Rules (Block Words, Dates, Regex Patterns) #18
Labels
No labels
bug
enhancement
enhancement
enhancement
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AutoRedact#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/karant-dev/AutoRedact/pull/16
Author: @Copilot
Created: 12/12/2025
Status: ✅ Merged
Merged: 12/12/2025
Merged by: @karant-dev
Base:
main← Head:copilot/add-custom-redaction-rules📝 Commits (5)
36238dbInitial plan137924eAdd custom redaction rules (block words, dates, regex patterns)bed88b5Address code review feedback: add regex lastIndex reset and improve date validationf7d639eFix over-redaction: only redact words that contain or match the sensitive textdca4867Refactor: extract hasValidOverlap helper to reduce code duplication📊 Changes
8 files changed (+806 additions, -88 deletions)
View changed files
📝
src/App.tsx(+25 -1)📝
src/components/Header.tsx(+30 -0)📝
src/components/SettingsDropdown.tsx(+317 -67)📝
src/hooks/useDetectionSettings.ts(+103 -1)📝
src/hooks/useOCR.ts(+15 -10)📝
src/types/index.ts(+10 -0)➕
src/utils/datePatterns.ts(+197 -0)📝
src/utils/ocr.ts(+109 -9)📄 Description
blockWords(string[]),customRegex(CustomRegexRule[]), andcustomDates(string[]) toDetectionSettingsdatePatterns.ts) to generate multiple date format regex patterns from a date stringuseDetectionSettingshook: Add functions to manage block words, custom regex patterns, and custom dates with validationocr.tsanduseOCR.tsto include block words, dates, and custom regexSettingsDropdown.tsxwith Block Words, Custom Dates, and Custom Regex fields with validationhasValidOverlaphelper function to reduce code duplicationBug Fix
Fixed issue where custom rules (block words, dates, regex) would redact entire lines instead of just the matching text. The fix adds text-based validation on top of positional overlap detection - now a word is only redacted if it actually contains the matched text or vice versa.
Before:
DATE:12-12-25*TIME:06:22*would be entirely redacted when matching date12-12-25After: Only the specific date portion is redacted
Screenshots
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.