diff mod_rest/mod_rest.lua @ 3832:0d4146cf9fbc

mod_rest: Enforce single child policy for outgoing it stanzas
author Kim Alvefur <zash@zash.se>
date Fri, 03 Jan 2020 18:29:10 +0100
parents 802087d3155a
children 501c7edc8c37
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Fri Jan 03 16:33:40 2020 +0100
+++ b/mod_rest/mod_rest.lua	Fri Jan 03 18:29:10 2020 +0100
@@ -106,6 +106,8 @@
 	if payload.name == "iq" then
 		if payload.attr.type ~= "get" and payload.attr.type ~= "set" then
 			return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" });
+		elseif #payload.tags ~= 1 then
+			return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" });
 		end
 		return module:send_iq(payload):next(
 			function (result)