commit 89fb91b: [Feature] Enable Mime part filters on antivirus module

jonmoesli jonathan.moesli at yahoo.com
Tue Nov 8 08:28:03 UTC 2022


Author: jonmoesli
Date: 2022-11-07 18:20:35 +0100
URL: https://github.com/rspamd/rspamd/commit/89fb91b649428dd8177cd7f431265d8a88634f79

[Feature] Enable Mime part filters on antivirus module

---
 src/plugins/lua/antivirus.lua | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index 968b24adc..39d11c8ec 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -134,6 +134,21 @@ local function add_antivirus_rule(sym, opts)
         type = 'string',
       })
 
+  -- if any mime_part filter defined, do not scan all attachments
+  if opts.mime_parts_filter_regex ~= nil
+      or opts.mime_parts_filter_ext ~= nil then
+    rule.scan_all_mime_parts = false
+  else
+    rule.scan_all_mime_parts = true
+  end
+
+  rule.patterns = common.create_regex_table(opts.patterns or {})
+  rule.patterns_fail = common.create_regex_table(opts.patterns_fail or {})
+
+  rule.mime_parts_filter_regex = common.create_regex_table(opts.mime_parts_filter_regex or {})
+
+  rule.mime_parts_filter_ext = common.create_regex_table(opts.mime_parts_filter_ext or {})
+  
   if opts.whitelist then
     rule.whitelist = rspamd_config:add_hash_map(opts.whitelist)
   end


More information about the Commits mailing list