aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_magic/heuristics.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-28 15:38:47 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-28 15:38:47 +0100
commita89cf52149a0790378ae21440406e6ea52780b58 (patch)
treee4301d97d3aeec6015b3d2aeb68f267b2228c5a5 /lualib/lua_magic/heuristics.lua
parentd0e464183bae561583cd77b5389e8c0e8e6a149f (diff)
downloadrspamd-a89cf52149a0790378ae21440406e6ea52780b58.tar.gz
rspamd-a89cf52149a0790378ae21440406e6ea52780b58.zip
[Fix] Disable text detection heuristics for encrypted parts
Issue: #3349
Diffstat (limited to 'lualib/lua_magic/heuristics.lua')
-rw-r--r--lualib/lua_magic/heuristics.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index d9d408170..8aeafae90 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -377,6 +377,19 @@ exports.text_part_heuristic = function(part, log_obj)
return true
end
+ local parent = part:get_parent()
+
+ if parent then
+ local parent_type,parent_subtype = parent:get_type()
+
+ if parent_type == 'multipart' and parent_subtype == 'encrypted' then
+ -- Skip text heuristics for encrypted parts
+ lua_util.debugm(N, log_obj, "text part check: parent is encrypted, not a text part")
+
+ return false
+ end
+ end
+
local content = part:get_content()
local clen = #content
local is_text