# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1480046773 -3600
# Node ID 0356216c474caf6e460e135b6385937f0fa4b6b5
# Parent  0647b821e00a834df82a847a53caaa83b17745e0
core.stanza_router: Require 'id' attribute on iq stanzas (fixes #785)

diff -r 0647b821e00a -r 0356216c474c core/stanza_router.lua
--- a/core/stanza_router.lua	Thu Nov 24 14:18:25 2016 +0100
+++ b/core/stanza_router.lua	Fri Nov 25 05:06:13 2016 +0100
@@ -70,6 +70,9 @@
 			if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then
 				origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children"));
 				return;
+			elseif not stanza.attr.id then
+				origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing required 'id' attribute"));
+				return;
 			end
 		end