From: Jose Celestino Date: Thu, 23 Jan 2025 12:42:40 +0000 (+0000) Subject: [Minor] Move url regexes to regexp/urls.lua X-Git-Tag: 3.11.1~32^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d9fb8a1ded3d78c7a0776b2c5a51311537ddda;p=thirdparty%2Frspamd.git [Minor] Move url regexes to regexp/urls.lua --- diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index 349bd204c4..3aba02d867 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -945,34 +945,6 @@ reconf['HAS_LIST_UNSUB'] = { group = 'headers' } -reconf['HAS_GUC_PROXY_URI'] = { - re = '/\\.googleusercontent\\.com\\/proxy/{url}i', - description = 'Has googleusercontent.com proxy URL', - score = 1.0, - group = 'url' -} - -reconf['HAS_GOOGLE_REDIR'] = { - re = '/\\.google\\.([a-z]{2,3}(|\\.[a-z]{2,3})|info|jobs)\\/(amp\\/s\\/|url\\?)/{url}i', - description = 'Has google.com/url or alike Google redirection URL', - score = 1.0, - group = 'url' -} - -reconf['HAS_GOOGLE_FIREBASE_URL'] = { - re = '/\\.firebasestorage\\.googleapis\\.com\\//{url}i', - description = 'Contains firebasestorage.googleapis.com URL', - score = 2.0, - group = 'url' -} - -reconf['HAS_FILE_URL'] = { - re = '/^file:\\/\\//{url}i', - description = 'Contains file:// URL', - score = 2.0, - group = 'url' -} - reconf['XM_UA_NO_VERSION'] = { re = string.format('(!%s && !%s) && (%s || %s) && !%s', 'X-Mailer=/https?:/H', diff --git a/rules/regexp/urls.lua b/rules/regexp/urls.lua new file mode 100644 index 0000000000..76c4115cd6 --- /dev/null +++ b/rules/regexp/urls.lua @@ -0,0 +1,31 @@ + +local reconf = config['regexp'] + +reconf['HAS_GUC_PROXY_URI'] = { + re = '/\\.googleusercontent\\.com\\/proxy/{url}i', + description = 'Has googleusercontent.com proxy URL', + score = 1.0, + group = 'url' +} + +reconf['HAS_GOOGLE_REDIR'] = { + re = '/\\.google\\.([a-z]{2,3}(|\\.[a-z]{2,3})|info|jobs)\\/(amp\\/s\\/|url\\?)/{url}i', + description = 'Has google.com/url or alike Google redirection URL', + score = 1.0, + group = 'url' +} + +reconf['HAS_GOOGLE_FIREBASE_URL'] = { + re = '/\\.firebasestorage\\.googleapis\\.com\\//{url}i', + description = 'Contains firebasestorage.googleapis.com URL', + score = 2.0, + group = 'url' +} + +reconf['HAS_FILE_URL'] = { + re = '/^file:\\/\\//{url}i', + description = 'Contains file:// URL', + score = 2.0, + group = 'url' +} + diff --git a/rules/rspamd.lua b/rules/rspamd.lua index e41a946cb8..3fc2d17977 100644 --- a/rules/rspamd.lua +++ b/rules/rspamd.lua @@ -30,6 +30,7 @@ dofile(local_rules .. '/regexp/headers.lua') dofile(local_rules .. '/regexp/misc.lua') dofile(local_rules .. '/regexp/upstream_spam_filters.lua') dofile(local_rules .. '/regexp/compromised_hosts.lua') +dofile(local_rules .. '/regexp/urls.lua') dofile(local_rules .. '/html.lua') dofile(local_rules .. '/headers_checks.lua') dofile(local_rules .. '/subject_checks.lua')