# HG changeset patch # User Senya # Date 1519412008 -7200 # Node ID 39485b9bbdd6b8bd0cefd658b400eb9c8499a17d # Parent d276bf3f046469542a0826331d5b9ef2f2ab1f96 mod_muc_eventsource: validate node with nodeprep diff -r d276bf3f0464 -r 39485b9bbdd6 mod_muc_eventsource/mod_muc_eventsource.lua --- 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;