From: Julien Schmidt Date: Tue, 30 May 2017 11:32:12 +0000 (+0800) Subject: [Minor] Validate assumed spoofed display name domains to contain a dot X-Git-Tag: 1.6.0~94^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1658%2Fhead;p=rspamd.git [Minor] Validate assumed spoofed display name domains to contain a dot A displayname of the form @ might have been mistaken for an email address --- diff --git a/rules/misc.lua b/rules/misc.lua index fff5d04cc..509a56e67 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -515,13 +515,12 @@ local check_from_display_name = rspamd_config:register_symbol{ -- Be careful with undisclosed-recipients:; as domain will be an empty string if to[1]['domain'] ~= '' and util.strequal_caseless(to[1]['domain'], parsed[1]['domain']) then task:insert_result('SPOOF_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain']) - else - task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain']) + return false end - return false - else - task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain']) end + -- Make sure we did not mistake e.g. @ for an email address + if not parsed[1]['domain']:find('%.') then return false end + task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain']) end return false end,