changeset 3801:d59fb4dcf100

mod_rest: Verify that @xmlns is left empty Prosody needs it to be empty internally.
author Kim Alvefur <zash@zash.se>
date Mon, 30 Dec 2019 07:22:15 +0100
parents cfa00eea896f
children f88e07630e4e
files mod_rest/README.markdown mod_rest/mod_rest.lua
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/README.markdown	Mon Dec 30 07:21:46 2019 +0100
+++ b/mod_rest/README.markdown	Mon Dec 30 07:22:15 2019 +0100
@@ -109,6 +109,9 @@
 
 The payload MUST contain one (1) `message`, `presence` or `iq` stanza.
 
+The stanzas MUST NOT have an `xmlns` attribute, and the default/empty
+namespace is treated as `jabber:client`.
+
 # Compatibility
 
 Requires Prosody trunk / 0.12
--- a/mod_rest/mod_rest.lua	Mon Dec 30 07:21:46 2019 +0100
+++ b/mod_rest/mod_rest.lua	Mon Dec 30 07:22:15 2019 +0100
@@ -24,6 +24,9 @@
 		-- parse fail
 		return errors.new({ code = 400, text = err });
 	end
+	if payload.attr.xmlns then
+		return errors.new({ code = 400, text = "'xmlns' attribute must be empty" });
+	end
 	local to = jid.prep(payload.attr.to);
 	if not to then
 		return errors.new({ code = 400, text = "Invalid destination JID" });