From 687f360797248d80cc17d1311d03697d8773cd23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 23 Aug 2019 10:13:05 +0200 Subject: omemo: ensure whitelist includes encryption tag in the correct format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_e2ee.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'poezio') diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index 624a36f2..75ce6fd0 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -70,7 +70,7 @@ class E2EEPlugin(BasePlugin): stanza_encryption = False #: Whitelist applied to messages when `stanza_encryption` is `False`. - tag_whitelist = list(map(lambda x: '{%s}%s' % (x[0], x[1]), [ + tag_whitelist = [ (JCLIENT_NS, 'body'), (EME_NS, EME_TAG), (HINTS_NS, 'store'), @@ -78,7 +78,7 @@ class E2EEPlugin(BasePlugin): (HINTS_NS, 'no-store'), (HINTS_NS, 'no-permanent-store'), # TODO: Add other encryption mechanisms tags here - ])) + ] #: Replaces body with `eme `_ #: if set. Should be suitable for most plugins except those using @@ -269,6 +269,8 @@ class E2EEPlugin(BasePlugin): if self.encrypted_tags is not None: whitelist += self.encrypted_tags + whitelist = {'{%s}%s' % tag for tag in whitelist} + for elem in message.xml[:]: if elem.tag not in whitelist: message.xml.remove(elem) -- cgit v1.2.3