Package org.nuxeo.common.utils
Class LinkRedactor
java.lang.Object
org.nuxeo.common.utils.LinkRedactor
Utility class for redacting linkable content from plain text before rendering in contexts where auto-linking may
occur (such as email clients).
Email clients like Gmail, Outlook and Apple Mail automatically convert plain-text URLs and email addresses into clickable links. This class provides methods to redact such patterns from user-provided text to prevent content spoofing.
- Since:
- 2025.18
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringredactLinks(String text) Redacts URLs and email addresses from the given plain text.
-
Field Details
-
LINK_REMOVED
Replacement text for redacted URLs.- See Also:
-
EMAIL_REMOVED
Replacement text for redacted email addresses.- See Also:
-
-
Method Details
-
redactLinks
Redacts URLs and email addresses from the given plain text.URLs are replaced with "[link removed]" and email addresses with "[email removed]". This prevents email clients from auto-linking user-provided content, which could be used for phishing.
- Parameters:
text- the text to sanitize, may benull- Returns:
- the sanitized text with URLs and emails redacted, or
nullif input wasnull
-