]> source.dussan.org Git - rspamd.git/commitdiff
[Rules] Add MULTIPLE_FROM rule
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Jul 2018 13:34:58 +0000 (14:34 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Jul 2018 13:34:58 +0000 (14:34 +0100)
rules/headers_checks.lua

index 0f578a44811972f8cc1b07ff2f3e5d39436ef1f9..ed2172fcd1fb9111de4756177dba6406136807d3 100644 (file)
@@ -563,6 +563,27 @@ rspamd_config.MISSING_FROM = {
   group = 'headers',
   description = 'Missing From: header'
 }
+
+rspamd_config.MULTIPLE_FROM = {
+  callback = function(task)
+    local from = task:get_from('mime')
+    if from and from[1] then
+      if #from > 1 then
+        return true,1.0,table.concat(
+            fun.totable(
+                fun.map(function(a) return a.addr end,
+                    fun.filter(function(a) return a.addr and a.addr ~= '' end,
+                        from))),
+            ',')
+      end
+    end
+    return false
+  end,
+  score = 9.0,
+  group = 'headers',
+  description = 'Multiple addresses in From'
+}
+
 rspamd_config.MV_CASE = {
   callback = function (task)
     local mv = task:get_header('Mime-Version', true)