feat(chat): Implement robust link filtering and sanitization #108

Merged
Collecting merged 2 commits from fix/link-removal-chatroom into main 2026-01-23 12:59:55 -05:00
Collaborator

Adds a comprehensive, multi-layered sanitization function to the chat system to detect and block users from posting links. This enhances user security, reduces spam, and lessens the burden on moderators.

The filtering logic is applied to all incoming and outgoing messages and includes several layers of defense:

  1. Standard URL Detection: Blocks common URL formats, including those with http://, https://, and www. prefixes.

  2. Obfuscation Defenses: Normalizes messages before scanning to defeat common bypass techniques. This includes removing all spaces and replacing text like (dot) and (slash) with their real character equivalents.

  3. Homoglyph Protection: Implements a manual replacement for the most common Cyrillic characters that are visually identical to Latin characters (e.g., 'о', 'а', 'е'). This prevents advanced bypass attempts using confusable characters.

  4. Reduced False Positives: The detection regex is carefully crafted to be specific to valid domain name characters, preventing it from incorrectly flagging filenames (e.g., setup.exe) or other legitimate text as links.

Adds a comprehensive, multi-layered sanitization function to the chat system to detect and block users from posting links. This enhances user security, reduces spam, and lessens the burden on moderators. The filtering logic is applied to all incoming and outgoing messages and includes several layers of defense: 1. Standard URL Detection: Blocks common URL formats, including those with http://, https://, and www. prefixes. 2. Obfuscation Defenses: Normalizes messages before scanning to defeat common bypass techniques. This includes removing all spaces and replacing text like (dot) and (slash) with their real character equivalents. 3. Homoglyph Protection: Implements a manual replacement for the most common Cyrillic characters that are visually identical to Latin characters (e.g., 'о', 'а', 'е'). This prevents advanced bypass attempts using confusable characters. 4. Reduced False Positives: The detection regex is carefully crafted to be specific to valid domain name characters, preventing it from incorrectly flagging filenames (e.g., setup.exe) or other legitimate text as links.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Kintoki/Emulator!108
No description provided.