Skip to content

Add Global Allowlist for Safe IPs/Domains#13

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/add-global-allowlist-feature
Closed

Add Global Allowlist for Safe IPs/Domains#13
Copilot wants to merge 4 commits intomainfrom
copilot/add-global-allowlist-feature

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 12, 2025

Users needed a way to prevent common safe values (localhost IPs, public DNS) from being redacted. This adds a configurable allowlist with sensible defaults and case-insensitive matching.

Changes

Allowlist Configuration (src/constants/allowlist.ts)

  • Default safe values: 127.0.0.1, localhost, 0.0.0.0, ::1, private ranges (192.168.x.x, 10.0.0.1), public DNS (8.8.8.8, 1.1.1.1)
  • O(1) Set-based lookups for performance

State Management

  • AllowlistContext with localStorage persistence
  • useAllowlist hook for component access

OCR Integration

  • useOCR.ts and utils/ocr.ts filter matches against allowlist before redaction
  • Works for both single image and batch processing

UI

  • Settings button (gear icon) in Header
  • Settings Modal to add/remove/reset allowlist values
// Filter logic applied to all match categories
const allowlistSet = createAllowlistSet(allowlist);
const filterAllowlisted = <T extends { text: string }>(matches: T[]): T[] =>
    matches.filter(m => !isAllowlisted(m.text, allowlistSet));

Screenshots

Settings Button

Settings Button

Settings Modal

Settings Modal

Additional Fix

Changed imageRef to loadedImage state in useOCR to resolve pre-existing lint error (ref accessed during render).

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feat]: Global Allowlist (Safe IPs/Domains)</issue_title>
<issue_description>### Is your feature request related to a problem?
AutoRedact keeps redacting my localhost IPs (127.0.0.1) and public DNS (8.8.8.8) which are safe to share.

Describe the solution you'd like

Add a "Safe Values" list in Settings.

  • Logic: If detected_text is in allow_list, skip redaction.
  • Have an opinionated default like safe IPs (ex: 127.0.0.1, localhost, local IP range, etc), but user can add more.

Describe alternatives you've considered

Deleting the redaction box manually every time.

Additional context

Should support exact strings (case-insensitive).</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: karant-dev <22682299+karant-dev@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 12, 2025

Deploying autoredact with  Cloudflare Pages  Cloudflare Pages

Latest commit: 68f7f2c
Status: ✅  Deploy successful!
Preview URL: https://97058869.autoredact.pages.dev
Branch Preview URL: https://copilot-add-global-allowlist.autoredact.pages.dev

View logs

Copilot AI and others added 2 commits December 12, 2025 14:19
Co-authored-by: karant-dev <22682299+karant-dev@users.noreply.github.com>
…ups for allowlist

Co-authored-by: karant-dev <22682299+karant-dev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add global allowlist for safe IPs and domains Add Global Allowlist for Safe IPs/Domains Dec 12, 2025
Copilot AI requested a review from karant-dev December 12, 2025 14:27
@karant-dev karant-dev removed their request for review December 12, 2025 14:27
@karant-dev
Copy link
Copy Markdown
Owner

karant-dev commented Dec 12, 2025

@copilot Sorry for rework but another PR acting on a similar settings modal was merged into main (separate feature), find a way to pull the latest changes and incorporate your work with it

@karant-dev
Copy link
Copy Markdown
Owner

Lot's changed, closing this PR and branch and will make a new one out of the same issue to start fresh.

@karant-dev karant-dev closed this Dec 12, 2025
@karant-dev karant-dev deleted the copilot/add-global-allowlist-feature branch December 12, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Global Allowlist (Safe IPs/Domains)

2 participants