Repository navigation
Detecting and blocking scam - #394
Merged
Merged
Conversation
Zabuzard
marked this pull request as draft
February 21, 2022 16:42
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
February 24, 2022 09:12
c05f237 to
1157c84
Compare
Member
Author
|
Waiting for #398 |
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 8, 2022 12:49
1157c84 to
57cd482
Compare
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 14, 2022 08:55
a76ccfb to
77657dc
Compare
Zabuzard
marked this pull request as ready for review
March 14, 2022 11:58
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 14, 2022 12:09
54c0348 to
714fe4c
Compare
Zabuzard
requested review from
Heatmanofurioso,
Tais993,
illuminator3,
java-coding-prodigy and
marko-radosavljevic
March 14, 2022 12:16
Tais993
requested changes
Mar 14, 2022
Tais993
reviewed
Mar 15, 2022
Tais993
requested changes
Mar 15, 2022
Tais993
left a comment
Member
There was a problem hiding this comment.
Some classes don't have documentation, can you take a look at that?
Not saying everything needs documentation, more of a question to you to take a look at that so classes that do need it receive it.
Member
Author
@Tais993 Do you remember which? I thought I added it everywhere. |
Tais993
requested changes
Mar 15, 2022
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 29, 2022 06:57
16fd01b to
cfe91c8
Compare
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 29, 2022 07:15
cfe91c8 to
d92fcaa
Compare
Tais993
requested changes
Mar 29, 2022
Tais993
left a comment
Member
There was a problem hiding this comment.
That's why I review multiple times :p
Tais993
reviewed
Mar 29, 2022
it basically moves getName(), onButtonClick() and onSelectionMenu() from SlashCommand one level higher - so that also non-slash-commands can use it
* also added junit parametrized test dependency * removed a useless gradle dep that was duplicated
Zabuzard
force-pushed
the
feature/block_scam_links
branch
from
March 29, 2022 10:13
2402c73 to
4134e41
Compare
|
Kudos, SonarCloud Quality Gate passed! |
Tais993
approved these changes
Mar 29, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Overview
Implements and closes #390.
This adds:
ScamDetectorScamBlockerScamHistoryStoreScamHistoryPurgeRoutineto purge the storeIt automatically attempts to detect scam messages, such as nitro scam and then takes actions agains, ranging from just logging the issue to deleting the message and quarantining the user.
The system is highly configurable and supports several modes:
OFFONLY_LOGAPPROVE_FIRSTAUTO_DELETE_BUT_APPROVE_QUARANTINEAUTO_DELETE_AND_QUARANTINEWe will probably start with a more manual mode, such as
APPROVE_FIRSTand then increase it incrementally depending on how well it goes.ScamBlockerThe blocker is highly configurable and has different actions depending on its mode.
OFF
The blocker is deactivated and does not scan for scam at all.
ONLY_LOG
The blocker detects scam but only logs a
WARNlevel message, no further action taken:APPROVE_FIRST
Detected scam will be sent to moderators for review. Any action has to be approved explicitly first.
If lacking the soft moderation role:
AUTO_DELETE_BUT_APPROVE_QUARANTINE
Detected scam will automatically be deleted. A moderator will be informed for review. They can then decide whether the user should be put into quarantine.
AUTO_DELETE_AND_QUARANTINE
The blocker will automatically delete any detected scam and put the user into quarantine.
ScamDetectorThe scam detector analyzes strings for scam. Its heuristic is highly configurable.
In general, it searches the content for keywords, such as
nitroand@everyone.Additionally, it searches for an URL and analyzes the host of the URL. It supports a white- and blacklist for the URL hosts. Also, it checks whether the URL contains an infix that is similar to a suspicious keyword, such as
discord(for examplewww.foo_disc0rd_bar.com).Based on those, two rules that determine scam are defined:
contains("nitro")andcontains("@everyone")andhasUrlcontains("nitro")andhasSuspiciousUrlIn both rules, the presence of
nitroin the message is mandatory.The following would be detected as a scam message by the first rule:

And the following would be matched by the second rule:

ScamHistoryStoreand Co.The store is mainly a wrapper around the new database table:
Entries are purged after 14 days by
ScamHistoryPurgeRoutine.The main purpose of the store is to detect scam duplicates for a graceful handling of multi-spam. In practice, users dont just post a single scam message, but instead they spam multiple channels with the same message. However, we only want to report it once to the mods for decision-making and take action, such as quarantining, also only once. Therefore, we track each scam in the store and can easily find duplicate scam messages.
In detail, when a scam message is detected, we will check whether there are recent duplicates (15 minutes) and if so, we will just not take any further action. For modes that issue an immediate deletion, we will silently delete the message though. For other modes, the action will be taken on all scam duplicates after clicking the button on the scam report.
Config
The config has changed. See
config.json.template. Here is a good default configuration:Checklist
General:
ScamDetectorModes:
Features: