Commit d5a52976 authored by Patrick Schmalstig's avatar Patrick Schmalstig
Browse files

Implemented MANTIS-5651 (Perceived spammer notifications confidence level...

Implemented MANTIS-5651 (Perceived spammer notifications confidence level should not be a percentile)
parent 0f665002
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ BYPASS_VALIDATION_HACK=Tried to cheat the system by making content automatically
HEADER_SPLIT_HACK=An HTTP header was generated from invalid data that would have caused a potential header-split attack. Check what data was invalid here and clean it.
EVAL_HACK=Tried to get something to eval() which was probably malicious
PATH_HACK=Tried to use a file path redirection to get outside the intended directory
ANTISPAM=Trigered anti-spam ban or block
ANTISPAM=Trigered anti-spam action '{1}' with a confidence of {2}%
CAPTCHAFAIL_HACK=Failed to complete the CAPTCHA while posting links in unrecognised Comcode-syntax
CAPTCHAFAIL=Failed to complete the CAPTCHA
PHP_DOWNLOAD_INNOCENT=Tried to download a '.php' file (download #{1}). This should not have happened and could indicate the site was compromised! Remove the download immediately and run a full security scan of the site.
@@ -266,11 +266,11 @@ ERROR_CHECKING_FOR_SPAMMERS=Could not run spam check using the [tt]{1}[/tt] serv
ERROR_CHECKING_FOR_SPAMMERS_RBL_IS_NORMAL_DNS=Could not run spam check using the [tt]{1}[/tt] service. This is a normal Domain Name Service instead of an actual RBL. Try changing the RBL configuration to use the IP address [tt]{2}[/tt]. The action has been let through without a check. The IP involved was [tt]{3}[/tt].
NOTIFICATION_TYPE_spam_check_block=Perceived spammer blocked
NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BAN=Perceived spammer banned ({1})
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BAN=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Their IP address has been banned.\n\nThe confidence level was {3}.\n\n{4}
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BAN=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Their IP address has been banned.\n\nThe confidence level was {3}%.\n\n{4}
NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BLOCK=Perceived spammer blocked ({1})
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BLOCK=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Their request has been blocked.\n\nThe confidence level was {3}.\n\n{4}
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BLOCK=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Their request has been blocked.\n\nThe confidence level was {3}%.\n\n{4}
NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_APPROVE=Possible spammer; validation may be required ({1})
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_APPROVE=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Validation will be required if they submitted something.\n\nThe confidence level was {3}.\n\n{4}
NOTIFICATION_SPAM_CHECK_BLOCK_BODY_APPROVE=A possible spammer was detected by the "{2}" service/rules (IP: [tt]{1}[/tt]). Validation will be required if they submitted something.\n\nThe confidence level was {3}%.\n\n{4}
SPAM_REPORT_TRIGGERED_SPAM_HEURISTICS=Multiple triggers to spam heuristics (such as blackholes, or splatter-gun link injection)
SPAM_REPORT_SITE_FLOODING=Flooding POST requests
SPAM_REPORT_NO_EMAIL_OR_USERNAME=We can't report this user because either there was no known username, or no known e-mail address. Stop Forum Spam requires full details.
+10 −10
Original line number Diff line number Diff line
@@ -396,12 +396,12 @@ function handle_perceived_spammer_by_confidence(string $user_ip, float $confiden

        if ($ban_happened) {
            require_code('notifications');
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BAN', $user_ip, $blocked_by, float_format($confidence_level), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BAN', $user_ip, $blocked_by, [float_format($confidence_level), $additional_criteria], get_site_default_lang());
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BAN', $user_ip, $blocked_by, float_format($confidence_level * 100.0), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BAN', $user_ip, $blocked_by, [float_format($confidence_level * 100.0), $additional_criteria], get_site_default_lang());
            dispatch_notification('core_staff:spam_check_block', null, $subject, $message, null, A_FROM_SYSTEM_PRIVILEGED);
        }

        log_hack_attack_and_exit('ANTISPAM', 'ban', float_to_raw_string($confidence_level), (($was_bannable) ? 10 : 0));
        log_hack_attack_and_exit('ANTISPAM', 'ban', float_format($confidence_level * 100.0), (($was_bannable) ? 10 : 0));

        warn_exit(do_lang_tempcode('STOPPED_BY_ANTISPAM', escape_html($user_ip), escape_html($blocked_by)));
    }
@@ -411,11 +411,11 @@ function handle_perceived_spammer_by_confidence(string $user_ip, float $confiden
        $spam_block_threshold = intval(get_option('spam_block_threshold'));
        if (intval($confidence_level * 100.0) >= $spam_block_threshold) {
            require_code('notifications');
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BLOCK', $user_ip, $blocked_by, float_format($confidence_level), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BLOCK', $user_ip, $blocked_by, [float_format($confidence_level), $additional_criteria], get_site_default_lang());
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_BLOCK', $user_ip, $blocked_by, float_format($confidence_level * 100.0), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_BLOCK', $user_ip, $blocked_by, [float_format($confidence_level * 100.0), $additional_criteria], get_site_default_lang());
            dispatch_notification('core_staff:spam_check_block', null, $subject, $message, null, A_FROM_SYSTEM_PRIVILEGED);

            log_hack_attack_and_exit('ANTISPAM', 'block', float_to_raw_string($confidence_level), intval(ceil($confidence_level * 10.0)));
            log_hack_attack_and_exit('ANTISPAM', 'block', float_format($confidence_level * 100.0), intval(ceil($confidence_level * 10.0)));

            warn_exit(do_lang_tempcode('STOPPED_BY_ANTISPAM', escape_html($user_ip), escape_html($blocked_by)));
        }
@@ -427,11 +427,11 @@ function handle_perceived_spammer_by_confidence(string $user_ip, float $confiden
        global $SPAM_REMOVE_VALIDATION;
        $SPAM_REMOVE_VALIDATION = true;

        // Only send notification if this was a POST request
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        // Only send notification if this was a POST request and contains interesting POST fields
        if (($_SERVER['REQUEST_METHOD'] == 'POST') && (has_interesting_post_fields())) {
            require_code('notifications');
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_APPROVE', $user_ip, $blocked_by, float_format($confidence_level), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_APPROVE', $user_ip, $blocked_by, [float_format($confidence_level), $additional_criteria], get_site_default_lang());
            $subject = do_lang('NOTIFICATION_SPAM_CHECK_BLOCK_SUBJECT_APPROVE', $user_ip, $blocked_by, float_format($confidence_level * 100.0), get_site_default_lang());
            $message = do_notification_lang('NOTIFICATION_SPAM_CHECK_BLOCK_BODY_APPROVE', $user_ip, $blocked_by, [float_format($confidence_level * 100.0), $additional_criteria], get_site_default_lang());
            dispatch_notification('core_staff:spam_check_block', null, $subject, $message, null, A_FROM_SYSTEM_PRIVILEGED);
        }
    }