diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-08 16:07:47 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-01-08 16:07:47 +0000 |
commit | 25fbf9a11b80c3a7ac2ecffbbd6c35760393c7df (patch) | |
tree | b683bfa7093b45e131244c7f0f04d5b3c289e649 /rules/misc.lua | |
parent | 4ae4107e61fa6eef71b4c84625d1df68849233d4 (diff) | |
download | rspamd-25fbf9a11b80c3a7ac2ecffbbd6c35760393c7df.tar.gz rspamd-25fbf9a11b80c3a7ac2ecffbbd6c35760393c7df.zip |
[Fix] Fix gpg parts misdetection
Issue: #3205
Diffstat (limited to 'rules/misc.lua')
-rw-r--r-- | rules/misc.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rules/misc.lua b/rules/misc.lua index 7d3682271..5dcf6ea05 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -685,12 +685,14 @@ local check_encrypted_name = rspamd_config:register_symbol{ local function check_part(part) if part:is_multipart() then local children = part:get_children() or {} + local text_kids = {} for _,cld in ipairs(children) do if cld:is_multipart() then check_part(cld) elseif cld:is_text() then seen_text = true + text_kids[#text_kids + 1] = cld else local type,subtype,_ = cld:get_type_full() @@ -712,6 +714,17 @@ local check_encrypted_name = rspamd_config:register_symbol{ end end end + if seen_text and seen_encrypted then + -- Ensure that our seen text is not really part of pgp #3205 + for _,tp in ipairs(text_kids) do + local t,_ = tp:get_type() + seen_text = false -- reset temporary + if t and t == 'text' then + seen_text = true + break + end + end + end end end end |