commit bf943d3: [Fix] Add more sanity checks for rua in dmarc_report

Vsevolod Stakhov vsevolod at rspamd.com
Thu Apr 14 19:49:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-04-14 20:42:42 +0100
URL: https://github.com/rspamd/rspamd/commit/bf943d3694f4c4a33765db3f24940d769747c85c (HEAD -> master)

[Fix] Add more sanity checks for rua in dmarc_report
Issue: #4148

---
 lualib/rspamadm/dmarc_report.lua | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua
index 41b463a80..c87a2c00e 100644
--- a/lualib/rspamadm/dmarc_report.lua
+++ b/lualib/rspamadm/dmarc_report.lua
@@ -293,7 +293,7 @@ local function process_rua(dmarc_domain, rua)
   local addrs = {}
   for _,a in ipairs(parts) do
     local u = rspamd_url.create(pool, a:gsub('!%d+[kmg]?$', ''))
-    if u then
+    if u and (u:get_protocol() or '') == 'mailto' and u:get_user() then
       -- Check each address for sanity
       if dmarc_domain == u:get_tld() or dmarc_domain == u:get_host() then
         -- Same domain - always include
@@ -328,6 +328,8 @@ local function process_rua(dmarc_domain, rua)
           end
         end
       end
+    else
+      logger.errx('invalid rua url: "%s""', tostring(u or 'null'))
     end
   end
 


More information about the Commits mailing list