From a2721b207b4fdb5dd958ebbdc33d5b1be5416b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 1 Jul 2019 12:29:18 +0200 Subject: e2ee-api: Always remove non-whitelisted subelements of messages 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'poezio/plugin_e2ee.py') diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index 0c9c9256..c45c0c74 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -207,11 +207,11 @@ class E2EEPlugin(BasePlugin): if self.replace_body_with_eme: self.core.xmpp['xep_0380'].replace_body_with_eme(message) - # Filter stanza with the whitelist if we don't do stanza encryption - if not self.stanza_encryption: - for elem in message.xml[:]: - if elem.tag not in self.tag_whitelist: - message.xml.remove(elem) + # Filter stanza with the whitelist. Plugins doing stanza encryption + # will have to include these in their encrypted container beforehand. + for elem in message.xml[:]: + if elem.tag not in self.tag_whitelist: + message.xml.remove(elem) log.debug('Encrypted %s message: %r', self.encryption_name, message['body']) return message -- cgit v1.2.3