aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-04-14 20:42:42 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-04-14 20:42:42 +0100
commitbf943d3694f4c4a33765db3f24940d769747c85c (patch)
tree1543607b026a65b54272f348ada6bc7c09e34839 /lualib
parentd89c7389ff1f7b7a8147dc658a4117ec0fe6f9cb (diff)
downloadrspamd-bf943d3694f4c4a33765db3f24940d769747c85c.tar.gz
rspamd-bf943d3694f4c4a33765db3f24940d769747c85c.zip
[Fix] Add more sanity checks for rua in dmarc_report
Issue: #4148
Diffstat (limited to 'lualib')
-rw-r--r--lualib/rspamadm/dmarc_report.lua4
1 files changed, 3 insertions, 1 deletions
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