diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2025-01-25 04:08:32 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-25 04:08:32 +0600 |
commit | 6f56e4858fab8db151766e023656be3cb8269427 (patch) | |
tree | 80e504cbc51d6f7e09ac4a4e6b8281f8f4b31f3b | |
parent | fe9dc0625eae2bfc8cff05c9b03aa82be1aa5265 (diff) | |
parent | 385a96c781c7539d95106929e7e19d5c798dd2c8 (diff) | |
download | rspamd-6f56e4858fab8db151766e023656be3cb8269427.tar.gz rspamd-6f56e4858fab8db151766e023656be3cb8269427.zip |
Merge pull request #5315 from japc/rules-regexp-url
[Minor] Rules regexp url separated and fix no subdomain cases for Google urls
-rw-r--r-- | rules/regexp/headers.lua | 28 | ||||
-rw-r--r-- | rules/regexp/urls.lua | 31 | ||||
-rw-r--r-- | rules/rspamd.lua | 1 |
3 files changed, 32 insertions, 28 deletions
diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index 349bd204c..3aba02d86 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 000000000..6dc99f008 --- /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 e41a946cb..3fc2d1797 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') |