aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-10-04 20:24:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-10-04 20:24:56 +0100
commit2116d177cd6da39c29c46338c090106b9aea3b22 (patch)
treee72fd44599a2053786f99e156445fc7b0e77afa1
parent9c2d72c6eba3fc05fd7459e388ea7c92eb87095f (diff)
downloadrspamd-2116d177cd6da39c29c46338c090106b9aea3b22.tar.gz
rspamd-2116d177cd6da39c29c46338c090106b9aea3b22.zip
[Minor] Neural: Allow to blacklist specific symbols
-rw-r--r--src/plugins/lua/neural.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index eda089abc..124877927 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -61,6 +61,7 @@ local default_options = {
symbol_spam = 'NEURAL_SPAM',
symbol_ham = 'NEURAL_HAM',
max_inputs = nil, -- when PCA is used
+ blacklisted_symbols = {}, -- list of symbols skipped in neural processing
}
local redis_profile_schema = ts.shape{
@@ -1428,6 +1429,9 @@ local function process_rules_settings()
end
local function filter_symbols_predicate(sname)
+ if settings.blacklisted_symbols and settings.blacklisted_symbols[sname] then
+ return false
+ end
local fl = rspamd_config:get_symbol_flags(sname)
if fl then
fl = lua_util.list_to_hash(fl)
@@ -1569,6 +1573,11 @@ local id = rspamd_config:register_symbol({
settings = lua_util.override_defaults(settings, module_config)
settings.rules = {} -- Reset unless validated further in the cycle
+if settings.blacklisted_symbols and settings.blacklisted_symbols[1] then
+ -- Transform to hash for simplicity
+ settings.blacklisted_symbols = lua_util.list_to_hash(settings.blacklisted_symbols)
+end
+
-- Check all rules
for k,r in pairs(rules) do
local rule_elt = lua_util.override_defaults(default_options, r)