Improving the filter #2689

Closed
opened 2019-05-16 13:16:21 +02:00 by DevilXD · 3 comments
DevilXD commented 2019-05-16 13:16:21 +02:00 (Migrated from github.com)

Feature request

Derived from here: https://github.com/Cog-Creators/Red-DiscordBot/issues/2687

Select the type of feature you are requesting:

  • Cog
  • Command
  • API functionality

Describe your requested feature

So, regarding the recent Filter change, I believe that adding a command that would allow either inclusive phase / string filtering, or a possibility to add an own regex filter pattern (since the filtering is being done with re anyway), would massively extend the filtering possibilities to encompass this behavior.

The suggested command would be [p]filter addi (add inclusive) or [p]filter addr (add regex).

The reason behind this addition is that filtered / not allowed words often come in different formats and forms. As an example, let's consider an end user disallowing usage of the word hack to discourage talking about this topic on their server. To do this effectively with the current implementation, they would also have to add hacks, hacking and hacked as the filtered words, requiring 4 commands in total. Maintaining a filter like this becomes a huge hassle as time goes on and more words and their different forms are added, also requiring more computational power during checking. This could be easily solved by allowing the end user to specify hack as inclusive, filtering messages with it in every possible case.

Because inclusive filtering may also lead to false-positives (like filtering tard in mustard), I'd lean more towards implementing adding regex patterns. Filtering hack and it's different forms would be as easy as doing: [p]filter addr hack(?:s|ed|ing)?

# Feature request Derived from here: https://github.com/Cog-Creators/Red-DiscordBot/issues/2687 #### Select the type of feature you are requesting: - [ ] Cog - [x] Command - [ ] API functionality #### Describe your requested feature So, regarding the recent Filter change, I believe that adding a command that would allow either inclusive phase / string filtering, or a possibility to add an own regex filter pattern (since the filtering is being done with re anyway), would massively extend the filtering possibilities to encompass this behavior. The suggested command would be `[p]filter addi` (add inclusive) or `[p]filter addr` (add regex). The reason behind this addition is that filtered / not allowed words often come in different formats and forms. As an example, let's consider an end user disallowing usage of the word `hack` to discourage talking about this topic on their server. To do this effectively with the current implementation, they would also have to add `hacks`, `hacking` and `hacked` as the filtered words, requiring 4 commands in total. Maintaining a filter like this becomes a huge hassle as time goes on and more words and their different forms are added, also requiring more computational power during checking. This could be easily solved by allowing the end user to specify `hack` as inclusive, filtering messages with it in every possible case. Because inclusive filtering may also lead to false-positives (like filtering `tard` in `mustard`), I'd lean more towards implementing adding regex patterns. Filtering `hack` and it's different forms would be as easy as doing: `[p]filter addr hack(?:s|ed|ing)?`
mikeshardmind commented 2019-05-16 13:49:33 +02:00 (Migrated from github.com)

Adding additional commands to allow searching without the word boundaries would be reasonably accommodated.

We will not be adding user provided regex filter support to filter without a lot of consideration as to how to handle it safely. It is unlikely to be added for reasons below.

Python's regex engine is susceptible to ReDoS attacks, and this would be giving control of both the regex and input to any guild owner on a public instance, allowing any public instance with filter loaded to be crashed trivially.

The only sane way without a significant performance loss would be to use a different regex engine (re2), but this introduces a C++ lib dependency.

There are 3rd party cogs which take extra steps to handle regex, but each comes with downsides not suitable for the core cog.

Adding additional commands to allow searching without the word boundaries would be reasonably accommodated. We will not be adding user provided regex filter support to filter without a lot of consideration as to how to handle it safely. It is unlikely to be added for reasons below. Python's regex engine is susceptible to ReDoS attacks, and this would be giving control of both the regex and input to any guild owner on a public instance, allowing any public instance with filter loaded to be crashed trivially. The only sane way without a significant performance loss would be to use a different regex engine (re2), but this introduces a C++ lib dependency. There are 3rd party cogs which take extra steps to handle regex, but each comes with downsides not suitable for the core cog.
entchen66 commented 2020-02-29 14:57:52 +01:00 (Migrated from github.com)

I refering to this request and want to add some features, which are missing in the filter system by now.

  1. Filter needs a better list. We have 2020 and I neve saw a bad list like the list from filter cog. Many cogs have better lists. Even a debug will gave a better overview of filtered words. Furthermore a channel list command is missing. Maybe also a Clanup for cleaning filter settings for deleted channel. (If it isn't done automaticly)
  2. Add a channel parameter. On big public server it is a nogo to use commands in the public channel wich will add filters or even [p]mute is a command, wich can only be used in the channel a user should be muted... thats not cool for big public server.

Concider this

I refering to this request and want to add some features, which are missing in the filter system by now. 1. Filter needs a better list. We have 2020 and I neve saw a bad list like the list from filter cog. Many cogs have better lists. Even a debug will gave a better overview of filtered words. Furthermore a channel list command is missing. Maybe also a Clanup for cleaning filter settings for deleted channel. (If it isn't done automaticly) 2. Add a channel parameter. On big public server it is a nogo to use commands in the public channel wich will add filters or even [p]mute is a command, wich can only be used in the channel a user should be muted... thats not cool for big public server. **Concider this**
Owner

Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden.


Generated by Claude Code

Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
2 participants
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
Mrcoolgamer11/Red-DiscordBot#2689
No description provided.