Changeset

12177:024cc878f472

mod_bookmarks: Block publishing to older XEP-0402 v0.3.0 node Having both the :0 and :1 nodes would be especially awkward, since there is no upgrade path for this case. In theory, these should be rare since no clients should have been doing XEP-0402 unless mod_bookmarks(2) was enabled. This was guesstimated to be rare with most clients doing XEP-0048 with Private XML.
author Kim Alvefur <zash@zash.se>
date Mon, 10 Jan 2022 22:15:55 +0100
parents 12176:e7639625a848
children 12178:0aa99a6dfb3e
files plugins/mod_bookmarks.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_bookmarks.lua	Mon Jan 10 16:53:58 2022 +0100
+++ b/plugins/mod_bookmarks.lua	Mon Jan 10 22:15:55 2022 +0100
@@ -10,6 +10,7 @@
 local private_storage = module:open_store("private", "map");
 
 local namespace = "urn:xmpp:bookmarks:1";
+local namespace_old = "urn:xmpp:bookmarks:0";
 local namespace_private = "jabber:iq:private";
 local namespace_legacy = "storage:bookmarks";
 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
@@ -271,7 +272,13 @@
 	end
 
 	local publish = pubsub:get_child("publish");
-	if publish == nil or publish.attr.node ~= namespace_legacy then
+	if publish == nil then return end
+	if publish.attr.node == namespace_old then
+		session.send(st.error_reply(stanza, "modify", "not-allowed",
+			"Your client does XEP-0402 version 0.3.0 but 0.4.0+ is required"));
+		return true;
+	end
+	if publish.attr.node ~= namespace_legacy then
 		return;
 	end