diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-05 16:41:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 16:41:47 +0000 |
commit | 2000e327bbb11abb2d0c219105690adcd4470bc9 (patch) | |
tree | 4c9a115c199742d4c40f37916285c422b38eb1da | |
parent | a659d1a9f04da051a45eb55e242bcec5491dca4e (diff) | |
parent | 406bad22196d736b3897673d05c6dc3db68f1fb7 (diff) | |
download | rspamd-2000e327bbb11abb2d0c219105690adcd4470bc9.tar.gz rspamd-2000e327bbb11abb2d0c219105690adcd4470bc9.zip |
Merge pull request #2062 from moisseev/headers
[Fix] Fix *_EXCESS_BASE64 rules
-rw-r--r-- | rules/regexp/headers.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index 0d1755741..39ae3c8cb 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -36,9 +36,9 @@ reconf['SUBJECT_NEEDS_ENCODING'] = { 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' +local raw_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), + re = string.format('!(%s) & !(%s) & (%s)', from_encoded_b64, from_encoded_qp, raw_from_needs_mime), score = 1.0, description = 'From header needs encoding', group = 'header' @@ -46,9 +46,9 @@ reconf['FROM_NEEDS_ENCODING'] = { 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' +local raw_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), + re = string.format('!(%s) & !(%s) & (%s)', to_encoded_b64, to_encoded_qp, raw_to_needs_mime), score = 1.0, description = 'To header needs encoding', group = 'header' @@ -165,8 +165,9 @@ reconf['TRACKER_ID'] = { group = 'header' } - --- Final rule +-- From contains only 7bit characters (parsed headers are used) +local from_needs_mime = 'From=/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\xff]/Hr' +-- From that contains encoded characters while base 64 is not needed as all symbols are 7bit reconf['FROM_EXCESS_BASE64'] = { re = string.format('%s & !%s', from_encoded_b64, from_needs_mime), score = 1.5, @@ -175,7 +176,6 @@ reconf['FROM_EXCESS_BASE64'] = { } -- From that contains encoded characters while quoted-printable is not needed as all symbols are 7bit --- Final rule reconf['FROM_EXCESS_QP'] = { re = string.format('%s & !%s', from_encoded_qp, from_needs_mime), score = 1.2, @@ -183,9 +183,9 @@ reconf['FROM_EXCESS_QP'] = { group = 'excessqp' } +-- To contains only 7bit characters (parsed headers are used) +local to_needs_mime = 'To=/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\xff]/Hr' -- To that contains encoded characters while base 64 is not needed as all symbols are 7bit --- Regexp that checks that To header is encoded with base64 (search in raw headers) --- Final rule reconf['TO_EXCESS_BASE64'] = { re = string.format('%s & !%s', to_encoded_b64, to_needs_mime), score = 1.5, |