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
{{ message }}
Repository navigation
feat(analyzer): Add configurable offline mode to EmailRecognizer to prevent external PSL network calls #2447
Is your feature request related to a problem? Please describe.
In strictly offline, air-gapped, or firewalled enterprise environments, EmailRecognizer can trigger unexpected outbound HTTP calls or socket timeouts during validation because tldextract.extract() attempts to fetch/update the latest Public Suffix List (PSL) from publicsuffix.org. (Historically discussed in #1205).
Describe the solution you'd like
Introduce an opt-in offline: bool = False parameter to EmailRecognizer and its YAML configuration schema (EmailRecognizerConfig):
offline=False (default): Preserves 100% backward compatibility using standard tldextract.extract.
offline=True: Instantiates tldextract.TLDExtract(suffix_list_urls=()), which strictly uses the snapshot bundled inside the package wheel, completely disabling all external network access.
Describe alternatives you've considered
Overriding validate_result via subclasses or pre-populating container cache directories manually, but having a native, loader-compatible offline: true flag in Presidio provides a clean, zero-workaround solution for air-gapped deployments.
Additional context
I have implemented and tested this locally:
Unit tests verifying email detection with offline=True.
Monkeypatch test asserting suffix_list_urls=() is passed to TLDExtract.
Full YAML validation via EmailRecognizerConfig registered in CONFIG_MODEL_MAP.
End-to-end RecognizerRegistryProvider test verifying both offline: true and supported_entities mapping/analysis.
I can submit a Pull Request right away if this approach looks good!
Activity