git » sdk » commit b868392

Strip unencrypted payloads from legacy OMEMO

author Stephen Paul Weber
2026-07-13 17:05:55 UTC
committer Stephen Paul Weber
2026-07-13 17:05:55 UTC
parent 61fa462c874bc52df833d01447b2fa1316893371

Strip unencrypted payloads from legacy OMEMO

Keep correction tag for edits, leaks only a local id which was already
visible. Addresses for multiPM which are equivalent to the from/to and
the receipts request which leaks only that our client supports receipts.
Thread id is just an opaque id, and people expect it to work...

borogove/OMEMO.hx +9 -1

diff --git a/borogove/OMEMO.hx b/borogove/OMEMO.hx
index ab2e7e4..b8be3fd 100644
--- a/borogove/OMEMO.hx
+++ b/borogove/OMEMO.hx
@@ -1108,7 +1108,15 @@ class OMEMO {
 
 		final promStanza = promHeader.then((header) -> {
 			final newStanza = stanza.clone();
-			newStanza.removeChildren("body");
+			// Remove most unencrypted leaks from legacy OMEMO
+			for (c in newStanza.allTags()) {
+				if (
+					!["thread"].contains(c.name) &&
+					!["urn:xmpp:message-correct:0", "http://jabber.org/protocol/address", "urn:xmpp:receipts"].contains(c.attr.get("xmlns"))
+				) {
+					newStanza.removeChild(c);
+				}
+			}
 			newStanza.addChild(header);
 			newStanza.textTag("encryption", "", { xmlns: "urn:xmpp:eme:0", namespace: "eu.siacs.conversations.axolotl" });
 			newStanza.textTag("body", "I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo");