diff options
author | Steve Freegard <steve@stevefreegard.com> | 2018-03-01 14:23:25 +0000 |
---|---|---|
committer | Steve Freegard <steve@stevefreegard.com> | 2018-03-01 14:23:25 +0000 |
commit | 9a0a04ce5b370d0347cd45021754d59f3de9460e (patch) | |
tree | d79f6c51f2fcc47f59cf967450659271c9d14f80 /rules/regexp/headers.lua | |
parent | a4785dd1692193be0f34f5d99a278af52e052770 (diff) | |
download | rspamd-9a0a04ce5b370d0347cd45021754d59f3de9460e.tar.gz rspamd-9a0a04ce5b370d0347cd45021754d59f3de9460e.zip |
Add additional needs_encoding rules
Diffstat (limited to 'rules/regexp/headers.lua')
-rw-r--r-- | rules/regexp/headers.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index 8dc8e9777..6d1911b1d 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -34,6 +34,26 @@ reconf['SUBJECT_NEEDS_ENCODING'] = { group = 'header' } +local from_encoded_b64 = 'From=/=\\?\\S+\\?B\\?/iX' +local from_encoded_qp = 'From=/=\\?\\S+\\?Q\\?/iX' +local from_needs_mime = 'From=/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\xff]/X' +reconf['FROM_NEEDS_ENCODING'] = { + re = string.format('!(%s) & !(%s) & (%s)', from_encoded_b64, from_encoded_qp, from_needs_mime), + score = 1.0, + description = 'From header needs encoding', + group = 'header' +} + +local to_encoded_b64 = 'To=/=\\?\\S+\\?B\\?/iX' +local to_encoded_qp = 'To=/=\\?\\S+\\?Q\\?/iX' +local to_needs_mime = 'To=/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\xff]/X' +reconf['TO_NEEDS_ENCODING'] = { + re = string.format('!(%s) & !(%s) & (%s)', to_encoded_b64, to_encoded_qp, to_needs_mime), + score = 1.0, + description = 'To header needs encoding', + group = 'header' +} + -- Detects that there is no space in From header (e.g. Some Name<some@host>) reconf['R_NO_SPACE_IN_FROM'] = { re = 'From=/\\S<[-\\w\\.]+\\@[-\\w\\.]+>/X', |