Mercurial > prosody-modules
comparison mod_rest/mod_rest.lua @ 3807:b0449faca52b
mod_rest: Whitelist top level attributes in callback
Already done in HTTP sending endpoint.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 01 Jan 2020 10:59:24 +0100 |
parents | c0caee8f54bb |
children | 91ff86fc3b20 |
comparison
equal
deleted
inserted
replaced
3806:c0caee8f54bb | 3807:b0449faca52b |
---|---|
173 if not parsed then | 173 if not parsed then |
174 module:log("warn", "REST callback responded with invalid XML: %s, %q", err, body); | 174 module:log("warn", "REST callback responded with invalid XML: %s, %q", err, body); |
175 elseif parsed.name ~= stanza.name then | 175 elseif parsed.name ~= stanza.name then |
176 module:log("warn", "REST callback responded with the wrong stanza type, got %s but expected %s", parsed.name, stanza.name); | 176 module:log("warn", "REST callback responded with the wrong stanza type, got %s but expected %s", parsed.name, stanza.name); |
177 else | 177 else |
178 parsed.attr.to, parsed.attr.from = stanza.attr.from, stanza.attr.to; | 178 parsed.attr = { |
179 from = stanza.attr.to, | |
180 to = stanza.attr.from, | |
181 id = parsed.attr.id or id.medium(); | |
182 type = parsed.attr.type, | |
183 ["xml:lang"] = parsed.attr["xml:lang"], | |
184 }; | |
179 if parsed.name == "iq" or parsed.attr.type == "error" then | 185 if parsed.name == "iq" or parsed.attr.type == "error" then |
180 parsed.attr.id = stanza.attr.id; | 186 parsed.attr.id = stanza.attr.id; |
181 end | 187 end |
182 reply = parsed; | 188 reply = parsed; |
183 end | 189 end |