Files
bandit/examples/xml_minidom.py
Rob Fletcher 18285c1bb9 Add XML vulnerability checking
This adds an XML plug-in based on the documentation an defusedxml.

Change-Id: Id775cd0f3d45fd2e9dac1c5bca5c36e0b5618066
2015-04-24 09:58:26 -07:00

15 lines
463 B
Python

from xml.dom.minidom import parseString as badParseString
from defusedxml.minidom import parseString as goodParseString
a = badParseString("<myxml>Some data some more data</myxml>")
print a
b = goodParseString("<myxml>Some data some more data</myxml>")
print b
from xml.dom.minidom import parse as badParse
from defusedxml.minidom import parse as goodParse
a = badParse("somfilethatdoesntexist.xml")
print a
b = goodParse("somefilethatdoesntexist.xml")
print b