]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Add more sanity checks for rua in dmarc_report
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 14 Apr 2022 19:42:42 +0000 (20:42 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 14 Apr 2022 19:42:42 +0000 (20:42 +0100)
Issue: #4148

lualib/rspamadm/dmarc_report.lua

index 41b463a8074be1d8ca70e20ae932fd308a4f69e8..c87a2c00e4dfc91e002f87c0ddbab6ef8fb7faec 100644 (file)
@@ -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