From: Vsevolod Stakhov Date: Sun, 25 Feb 2024 15:27:33 +0000 (+0000) Subject: [Fix] Avoid stupid practice of polluting module's internal state X-Git-Tag: 3.8.4~1^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=33c00d45023cdfd0cc1f53f149a1fe2e4c8ebc4c;p=rspamd.git [Fix] Avoid stupid practice of polluting module's internal state --- diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua index 42c801eed..a54e12d67 100644 --- a/lualib/rspamadm/dmarc_report.lua +++ b/lualib/rspamadm/dmarc_report.lua @@ -19,7 +19,6 @@ local lua_util = require "lua_util" local logger = require "rspamd_logger" local lua_redis = require "lua_redis" local dmarc_common = require "plugins/dmarc" -local lupa = require "lupa" local rspamd_mempool = require "rspamd_mempool" local rspamd_url = require "rspamd_url" local rspamd_text = require "rspamd_text" @@ -176,8 +175,6 @@ local function escape_xml(input) return '' end --- Enable xml escaping in lupa templates -lupa.filters.escape_xml = escape_xml -- Creates report XML header local function report_header(reporting_domain, report_start, report_end, domain_policy) @@ -211,7 +208,10 @@ local function report_header(reporting_domain, report_start, report_end, domain_ report_end = report_end, domain_policy = domain_policy, reporting_domain = reporting_domain, - }, true) + }, true, false, + { + escape_xml = escape_xml + }) end -- Generate xml entry for a preprocessed redis row @@ -248,7 +248,10 @@ local function entry_to_xml(data) ]] - return lua_util.jinja_template(xml_template, { data = data }, true) + return lua_util.jinja_template(xml_template, { data = data }, true, + false, { + escape_xml = escape_xml + }) end -- Process a report entry stored in Redis splitting it to a lua table @@ -534,10 +537,15 @@ local function prepare_report(opts, start_time, end_time, rep_key) message_id = rspamd_util.random_hex(16) .. '@' .. report_settings.msgid_from, report_start = start_time, report_end = end_time - }, true) + }, true, + false, { + escape_xml = escape_xml + }) local rfooter = lua_util.jinja_template(report_footer, { uuid = uuid, - }, true) + }, true, false, { + escape_xml = escape_xml + }) local message = rspamd_text.fromtable { (rhead:gsub("\n", "\r\n")), rspamd_util.encode_base64(rspamd_util.gzip_compress(xml_to_compress), 73),