Changeset

2897:39485b9bbdd6

mod_muc_eventsource: validate node with nodeprep
author Senya <senya@kinetiksoft.com>
date Fri, 23 Feb 2018 20:53:28 +0200
parents 2896:d276bf3f0464
children 2898:9fd61234b6f0
files mod_muc_eventsource/mod_muc_eventsource.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_eventsource/mod_muc_eventsource.lua	Tue Feb 27 14:02:26 2018 +0000
+++ b/mod_muc_eventsource/mod_muc_eventsource.lua	Fri Feb 23 20:53:28 2018 +0200
@@ -1,4 +1,5 @@
 module:depends("http");
+local nodeprep = require "util.encodings".stringprep.nodeprep;
 
 local jid_split = require "util.jid".split;
 local json = require "util.json";
@@ -15,9 +16,15 @@
 end
 
 function serve_stream(event, node)
+	local response = event.response;
+
+	node = nodeprep(node);
+	if node == nil then
+		return 400;
+	end
+
 	module:log("debug", "Client subscribed to: %s", node);
 
-	local response = event.response;
 	response.on_destroy = client_closed;
 	response._eventsource_node = node;