Browse Source

[Feature] Add rules to detect bad 8bit characters in From and To

tags/1.6.0
Vsevolod Stakhov 7 years ago
parent
commit
07f4054d92
1 changed files with 36 additions and 0 deletions
  1. 36
    0
      rules/headers_checks.lua

+ 36
- 0
rules/headers_checks.lua View File

@@ -918,3 +918,39 @@ rspamd_config.CTYPE_MIXED_BOGUS = {
score = 0.1,
group = 'headers'
}

local function is_8bit_addr(addr)
if addr.flags and addr.flags['8bit'] then
return true
end

return false;
end

rspamd_config.INVALID_FROM_8BIT = {
callback = function(task)
local from = (task:get_from('mime') or {})[1] or {}
if is_8bit_addr(from) then
return true
end
return false
end,
description = 'Invalid 8bit character in From header',
score = 6.0,
group = 'headers'
}

rspamd_config.INVALID_RCPT_8BIT = {
callback = function(task)
local rcpts = task:get_recipients('mime') or {}
return fun.any(function(rcpt)
if is_8bit_addr(rcpt) then
return true
end
return false
end, rcpts)
end,
description = 'Invalid 8bit character in recipients headers',
score = 6.0,
group = 'headers'
}

Loading…
Cancel
Save