aboutsummaryrefslogtreecommitdiffstats
path: root/util/xml.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-02-04 20:47:39 +0100
committerKim Alvefur <zash@zash.se>2022-02-04 20:47:39 +0100
commit99a880ebe5e45655d63e1a72866d2d44b7497fd9 (patch)
tree650d8f0ddbdcf64d4d490a0f965e8f952b989c3a /util/xml.lua
parenteae775bc79c9c2a771212eedcdd7389b993078f0 (diff)
downloadprosody-99a880ebe5e45655d63e1a72866d2d44b7497fd9.tar.gz
prosody-99a880ebe5e45655d63e1a72866d2d44b7497fd9.zip
util.xml: Add an option to allow <?processing instructions?>
These should generally be safe to just ignore, which should be the default behavior of Expat and LuaExpat
Diffstat (limited to 'util/xml.lua')
-rw-r--r--util/xml.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/xml.lua b/util/xml.lua
index 9322f3ad..2bf1ff4e 100644
--- a/util/xml.lua
+++ b/util/xml.lua
@@ -72,11 +72,14 @@ local parse_xml = (function()
end
end
handler.StartDoctypeDecl = restricted_handler;
- handler.ProcessingInstruction = restricted_handler;
if not options or not options.allow_comments then
-- NOTE: comments are generally harmless and can be useful when parsing configuration files or other data, even user-provided data
handler.Comment = restricted_handler;
end
+ if not options or not options.allow_processing_instructions then
+ -- Processing instructions should generally be safe to just ignore
+ handler.ProcessingInstruction = restricted_handler;
+ end
local parser = lxp.new(handler, ns_separator);
local ok, err, line, col = parser:parse(xml);
if ok then ok, err, line, col = parser:parse(); end