Anti spam measures against hashtag spam (#13855)

This commit is contained in:
Michael Vogel 2024-01-25 19:41:07 +01:00 committed by GitHub
parent b3e4b9675a
commit 09edf251ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 278 additions and 252 deletions

View file

@ -113,6 +113,12 @@ class Relay
}
if (!empty($tagList) || !empty($denyTags)) {
$max_tags = $config->get('system', 'relay_max_tags');
if ($max_tags && (count($tags) > $max_tags) && preg_match('/[^@!#]\[url\=.*?\].*?\[\/url\]/ism', $body)) {
Logger::info('Possible hashtag spam detected - rejected', ['hashtags' => $tags, 'network' => $network, 'url' => $url, 'causer' => $causer, 'body' => $body]);
return false;
}
$content = mb_strtolower(BBCode::toPlaintext($body, false));
foreach ($tags as $tag) {