commit 2116d17: [Minor] Neural: Allow to blacklist specific symbols
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Oct 4 19:28:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-10-04 20:24:28 +0100
URL: https://github.com/rspamd/rspamd/commit/2116d177cd6da39c29c46338c090106b9aea3b22 (HEAD -> master)
[Minor] Neural: Allow to blacklist specific symbols
---
src/plugins/lua/neural.lua | 9 +++++++++
1 file changed, 9 insertions(+)
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)
More information about the Commits
mailing list