summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2022-03-20 20:19:54 +0100
committermathieui <mathieui@mathieui.net>2022-03-20 20:19:54 +0100
commite8679fe32b2ed6b59bbe4aa36f0f3ac912227038 (patch)
tree9906c9e3870402e9d7d7ac4ce96984657df82664
parentabd699593f53ec89b57d697296a6526bcfad7a8d (diff)
parent41d733e77fd4835a55de82f288b88a2196db81c8 (diff)
downloadslixmpp-e8679fe32b2ed6b59bbe4aa36f0f3ac912227038.tar.gz
slixmpp-e8679fe32b2ed6b59bbe4aa36f0f3ac912227038.tar.bz2
slixmpp-e8679fe32b2ed6b59bbe4aa36f0f3ac912227038.tar.xz
slixmpp-e8679fe32b2ed6b59bbe4aa36f0f3ac912227038.zip
Merge branch 'allow-disabling-defusedxml' into 'master'
Do not use defusedxml by default if available See merge request poezio/slixmpp!190
-rw-r--r--slixmpp/__init__.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/slixmpp/__init__.py b/slixmpp/__init__.py
index 403c9299..a4796d78 100644
--- a/slixmpp/__init__.py
+++ b/slixmpp/__init__.py
@@ -4,14 +4,18 @@
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
import logging
+from os import getenv
logging.getLogger(__name__).addHandler(logging.NullHandler())
-# Use defusedxml if available
-try:
- import defusedxml
- defusedxml.defuse_stdlib()
-except ImportError:
- pass
+# Use defusedxml if wanted
+# Since enabling it can have adverse consequences for the programs using
+# slixmpp, do not enable it by default.
+if getenv('SLIXMPP_ENABLE_DEFUSEDXML', default='false').lower() == 'true':
+ try:
+ import defusedxml
+ defusedxml.defuse_stdlib()
+ except ImportError:
+ pass
from slixmpp.stanza import Message, Presence, Iq
from slixmpp.jid import JID, InvalidJID