]> source.dussan.org Git - rspamd.git/commitdiff
rules/headers_checks.lua: add [ENV]FROM_INVALID 3346/head
authorJan Smutny <js@excello.cz>
Sat, 18 Apr 2020 22:20:32 +0000 (00:20 +0200)
committerJan Smutny <js@excello.cz>
Sat, 18 Apr 2020 22:22:14 +0000 (00:22 +0200)
rules/headers_checks.lua

index 9ceb601885e04be5f791b35da39c0c11d9b1768a..6c548982270454e6bed6b8e21b6b5c35de48b840 100644 (file)
@@ -626,7 +626,13 @@ local check_from_id = rspamd_config:register_symbol{
   callback = function(task)
     local envfrom = task:get_from(1)
     local from = task:get_from(2)
+    if (envfrom and envfrom[1] and not envfrom[1]["flags"]["valid"]) then
+      task:insert_result('ENVFROM_INVALID', 1.0)
+    end
     if (from and from[1]) then
+      if not (from[1]["flags"]["valid"]) then
+        task:insert_result('FROM_INVALID', 1.0)
+      end
       if (from[1].name == nil or from[1].name == '' ) then
         task:insert_result('FROM_NO_DN', 1.0)
       elseif (from[1].name and
@@ -672,6 +678,22 @@ local check_from_id = rspamd_config:register_symbol{
   end
 }
 
+rspamd_config:register_symbol{
+  name = 'ENVFROM_INVALID',
+  score = 2.0,
+  group = 'headers',
+  parent = check_from_id,
+  type = 'virtual',
+  description = 'Envelope from does not have a valid format',
+}
+rspamd_config:register_symbol{
+  name = 'FROM_INVALID',
+  score = 2.0,
+  group = 'headers',
+  parent = check_from_id,
+  type = 'virtual',
+  description = 'From header does not have a valid format',
+}
 rspamd_config:register_symbol{
   name = 'FROM_NO_DN',
   score = 0.0,