MUC: Enforce strict resourceprep when registering room nicknames
authorKim Alvefur <zash@zash.se>
Sat, 02 May 2020 20:12:41 +0200
changeset 10798 4585fe53e21f
parent 10797 9ce67da45e54
child 10799 4c90f06f2247
MUC: Enforce strict resourceprep when registering room nicknames If nickname enforcement is enabled this would otherwise let you bypass the join check in muc.lib by registering an invalid nickname and then joining with any nickname, letting register.lib change it to the invalid registered nick.
plugins/muc/register.lib.lua
--- a/plugins/muc/register.lib.lua	Sat May 02 14:13:02 2020 +0200
+++ b/plugins/muc/register.lib.lua	Sat May 02 20:12:41 2020 +0200
@@ -152,7 +152,7 @@
 			return true;
 		end
 		-- Is the nickname valid?
-		local desired_nick = resourceprep(reg_data["muc#register_roomnick"]);
+		local desired_nick = resourceprep(reg_data["muc#register_roomnick"], true);
 		if not desired_nick then
 			origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid Nickname"));
 			return true;