diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-13 19:18:12 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-13 19:18:12 +0100 |
commit | b93f976e37deaa545765cf0a935758eb630c3c45 (patch) | |
tree | dc1f5a6d693d44bff9249c6b1e36fd5bd55a0010 /rules/misc.lua | |
parent | 39276ce5d4284765d4372f92b5f0337751dba52e (diff) | |
download | rspamd-b93f976e37deaa545765cf0a935758eb630c3c45.tar.gz rspamd-b93f976e37deaa545765cf0a935758eb630c3c45.zip |
[Rules] Penalise R_BAD_CTE_7BIT for utf8 messages
Diffstat (limited to 'rules/misc.lua')
-rw-r--r-- | rules/misc.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/rules/misc.lua b/rules/misc.lua index bc9b044eb..2e4d25418 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -597,13 +597,26 @@ rspamd_config.R_BAD_CTE_7BIT = { for _,p in ipairs(tp) do local cte = p:get_mimepart():get_cte() or '' if cte ~= '8bit' and p:has_8bit_raw() then - return true,1.0,cte + local _,_,attrs = p:get_mimepart():get_type_full() + local mul = 1.0 + local params = {cte} + if attrs then + print(attrs.charset) + if attrs.charset and attrs.charset:lower() == "utf-8" then + -- Penalise rule as people don't know that utf8 is surprisingly + -- eight bit encoding + mul = 0.3 + table.insert(params, "utf8") + end + end + + return true,mul,params end end return false end, - score = 4.0, + score = 3.5, description = 'Detects bad content-transfer-encoding for text parts', group = 'header' } |