Commit 803db4ee by Ned Batchelder

Fix safe_lxml. SEC-338

parent 1c027c43
...@@ -7,12 +7,17 @@ It also includes a safer XMLParser. ...@@ -7,12 +7,17 @@ It also includes a safer XMLParser.
For processing xml always prefer this over using lxml.etree directly. For processing xml always prefer this over using lxml.etree directly.
""" """
# This should be imported after lxml.etree so that it overrides the following attributes. # Names are imported into this module so that it can be a stand-in for
from defusedxml.lxml import XML, fromstring, parse # lxml.etree. The names are not used here, so disable the pylint warning.
# pylint: disable=unused-import, wildcard-import, unused-wildcard-import
from lxml.etree import XMLParser as _XMLParser from lxml.etree import XMLParser as _XMLParser
from lxml.etree import * # pylint: disable=wildcard-import, unused-wildcard-import; pylint: disable=unused-import from lxml.etree import *
from lxml.etree import _Element, _ElementTree from lxml.etree import _Element, _ElementTree
# This should be imported after lxml.etree so that it overrides the following attributes.
from defusedxml.lxml import XML, fromstring, parse
class XMLParser(_XMLParser): # pylint: disable=function-redefined class XMLParser(_XMLParser): # pylint: disable=function-redefined
""" """
......
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