Commit 687f3607 authored by Maxime Buquet's avatar Maxime Buquet

omemo: ensure whitelist includes encryption tag in the correct format

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 83e83055
......@@ -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 <https://xmpp.org/extensions/xep-0380.html>`_
#: 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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment