summaryrefslogtreecommitdiff
path: root/poezio/plugin_e2ee.py
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-07-01 12:17:14 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-07-01 19:42:45 +0200
commit2fb0cdbb88e0bef398a1073f91187815897286ab (patch)
treedb3839d6c7cc43f70a02739c6563cea8f8eac061 /poezio/plugin_e2ee.py
parent47103fc5ebb8db6b597ea233229ec8de932ae99d (diff)
downloadpoezio-2fb0cdbb88e0bef398a1073f91187815897286ab.tar.gz
poezio-2fb0cdbb88e0bef398a1073f91187815897286ab.tar.bz2
poezio-2fb0cdbb88e0bef398a1073f91187815897286ab.tar.xz
poezio-2fb0cdbb88e0bef398a1073f91187815897286ab.zip
e2ee-api: Drop message if no body and no stanza encryption
To avoid leaking data when plugin doesn't do stanza encryption. This will inevitably reduce the number of features available, but users want to send "secure" messages right. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'poezio/plugin_e2ee.py')
-rw-r--r--poezio/plugin_e2ee.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index 66a8bd97..0c9c9256 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -179,6 +179,17 @@ class E2EEPlugin(BasePlugin):
has_body = message.xml.find('{%s}%s' % (JCLIENT_NS, 'body')) is not None
+ # Drop all messages that don't contain a body if the plugin doesn't do
+ # Stanza Encryption
+ if not self.stanza_encryption and not has_body:
+ log.debug(
+ '%s plugin: Dropping message as it contains no body, and is '
+ 'not doesn\'t do stanza encryption: %r',
+ self.encryption_name,
+ message,
+ )
+ return None
+
# Call the enabled encrypt method
self._enabled_tabs[jid](message, tab)