]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Skip empty In-Reply-To header in replies check 5922/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 5 Mar 2026 17:09:40 +0000 (20:09 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 5 Mar 2026 17:23:39 +0000 (20:23 +0300)
An empty `In-Reply-To` header value ("") is truthy in Lua,
bypassing the `nil` check. In `replies_check` this caused a
misleading log entry "ignoring reply to  as no recipients
are matching hash ". In `replies_check_cookie` it triggered
an unnecessary `decrypt_cookie` call.

src/plugins/lua/replies.lua

index 2f0153d002a3ef92806fe6b6204c40003c2a0dd1..0cad37cfbbab7790afb3a005dbdea0a3b05e1e5c 100644 (file)
@@ -216,9 +216,9 @@ local function replies_check(task)
       end
     end
   end
-  -- If in-reply-to header not present return
+  -- If in-reply-to header not present or empty return
   in_reply_to = task:get_header_raw('in-reply-to')
-  if not in_reply_to then
+  if not in_reply_to or #in_reply_to == 0 then
     return
   end
   -- Create hash of in-reply-to and query redis
@@ -322,9 +322,9 @@ local function replies_check_cookie(task)
     end
   end
 
-  -- If in-reply-to header not present return
+  -- If in-reply-to header not present or empty return
   local irt = task:get_header('in-reply-to')
-  if irt == nil then
+  if not irt or #irt == 0 then
     return
   end
   local cr = require "rspamd_cryptobox"