From: Vsevolod Stakhov Date: Wed, 19 Nov 2025 09:51:20 +0000 (+0000) Subject: [Fix] Fix RBL plugin transform schemas X-Git-Tag: 3.14.1~11^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=244f29299f5546b1d67a0f08381da8978d232274;p=thirdparty%2Frspamd.git [Fix] Fix RBL plugin transform schemas - Transform inner schema now validates the result, not input - Updated return_codes_schema and return_bits_schema - Transform functions now handle type conversion properly --- diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua index 60c265d298..c53c103bf9 100644 --- a/lualib/plugins/rbl.lua +++ b/lualib/plugins/rbl.lua @@ -62,8 +62,12 @@ local return_codes_schema = T.table({}, { key = T.transform(T.string(), string.upper), extra = T.one_of({ T.array(T.string()), - T.transform(T.string(), function(s) - return { s } + -- Transform string to array, inner schema validates the result + T.transform(T.array(T.string()), function(val) + if type(val) == "string" then + return { val } + end + return val end) }) }):doc({ summary = "Map of symbol names to IP patterns" }) @@ -76,11 +80,14 @@ local return_bits_schema = T.table({}, { T.number(), T.transform(T.string(), tonumber) })), - T.transform(T.string(), function(s) - return { tonumber(s) } - end), - T.transform(T.number(), function(s) - return { s } + -- Transform string or number to array, inner schema validates the result + T.transform(T.array(T.number()), function(val) + if type(val) == "string" then + return { tonumber(val) } + elseif type(val) == "number" then + return { val } + end + return val end) }) }):doc({ summary = "Map of symbol names to bit numbers" })