]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Allow custom actions with flags in config validation 5740/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 10 Nov 2025 13:58:25 +0000 (13:58 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 10 Nov 2025 13:58:25 +0000 (13:58 +0000)
The config validation was warning about unknown actions even when they
were valid custom actions defined with flags like 'no_threshold'.

Custom actions (e.g., malware, virus, hard-reject) are properly supported
by the C code but the Lua validation didn't recognize them, causing
spurious warnings.

Fix by checking if an unknown action is defined as an object with flags
before emitting the warning.

lualib/lua_cfg_transform.lua

index ec11ef29960bfdfa0d30bd4579127193a243b9af..8060e26d5243d73e2597eb079eec5c0490cf9ae1 100644 (file)
@@ -350,9 +350,16 @@ return function(cfg)
     actions_set['grow_factor'] = true
     actions_set['subject'] = true
 
-    for k, _ in cfg:at('actions'):pairs() do
+    for k, v in cfg:at('actions'):pairs() do
       if not actions_set[k] then
-        logger.warnx(rspamd_config, 'unknown element in actions section: %s', k)
+        -- Check if this is a custom action with flags (e.g., no_threshold)
+        local is_custom_action = false
+        if v and v:type() == 'object' and v:at('flags') then
+          is_custom_action = true
+        end
+        if not is_custom_action then
+          logger.warnx(rspamd_config, 'unknown element in actions section: %s', k)
+        end
       end
     end