]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Normalize request header values
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 17 Jan 2026 12:19:17 +0000 (12:19 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 17 Jan 2026 12:19:17 +0000 (12:19 +0000)
lualib/lua_dkim_tools.lua
lualib/lua_selectors/extractors.lua
src/plugins/lua/settings.lua

index be446f8bc0bc604372f0e6932339d4e7b21864f4..78c43516eb36e7bdaf0aa7b9265d2127fea21edb 100644 (file)
@@ -30,6 +30,9 @@ local function check_violation(N, task, domain)
   if N == 'arc' then
     sym_check = 'ARC_REJECT'
   end
+  if domain then
+    domain = tostring(domain)
+  end
   if task:has_symbol(sym_check) then
     local sym = task:get_symbol(sym_check)[1]
     logger.infox(task, 'skip signing for %s: violation %s found: %s',
@@ -96,6 +99,10 @@ local function parse_dkim_http_headers(N, task, settings)
       return false, {}
     end
 
+    domain = tostring(domain)
+    selector = tostring(selector)
+    key = tostring(key)
+
     -- Now check if we need to check the existing auth
     local hdr = task:get_request_header(headers.sign_on_reject_header)
     if not hdr or tostring(hdr) == '0' or tostring(hdr) == 'false' then
@@ -106,9 +113,9 @@ local function parse_dkim_http_headers(N, task, settings)
 
     local p = {}
     local k = {
-      domain = tostring(domain),
-      rawkey = tostring(key),
-      selector = tostring(selector),
+      domain = domain,
+      rawkey = key,
+      selector = selector,
     }
     table.insert(p, k)
     return true, p
index 29a05854ce4aacd247428fefce9775512b8f2769..efd37558c6e5303ce41ab6858bdc73bac4272096 100644 (file)
@@ -452,7 +452,7 @@ the key name]],
     ['get_value'] = function(task, args)
       local hdr = task:get_request_header(args[1])
       if hdr then
-        return hdr, 'string'
+        return tostring(hdr), 'string'
       end
 
       return nil
index f46443a13d735bb66bfeefe77444d2766c8ace6c..2762359a275381197e7b6be8c255587b630b6cf8 100644 (file)
@@ -120,7 +120,7 @@ local function check_query_settings(task)
   if query_set then
 
     local parser = ucl.parser()
-    local res, err = parser:parse_text(query_set)
+    local res, err = parser:parse_text(tostring(query_set))
     if res then
       if settings_id then
         rspamd_logger.warnx(task, "both settings-id '%s' and settings headers are presented, ignore settings-id; ",
@@ -971,7 +971,7 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static)
       return function(task)
         local rh = task:get_request_header(hname)
         if rh then
-          return { rh }
+          return { tostring(rh) }
         end
         return {}
       end