diff options
author | Christian Heimes <christian@python.org> | 2018-09-23 07:50:25 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-23 07:50:25 (GMT) |
commit | 17b1d5d4e36aa57a9b25a0e694affbd1ee637e45 (patch) | |
tree | 486acd3328d5e607bd05936fdfb73eb548d4fa90 /Lib/test/test_pulldom.py | |
parent | 9fb051f032c36b9f6086b79086b4d6b7755a3d70 (diff) | |
download | cpython-17b1d5d4e36aa57a9b25a0e694affbd1ee637e45.zip cpython-17b1d5d4e36aa57a9b25a0e694affbd1ee637e45.tar.gz cpython-17b1d5d4e36aa57a9b25a0e694affbd1ee637e45.tar.bz2 |
bpo-17239: Disable external entities in SAX parser (GH-9217)
The SAX parser no longer processes general external entities by default
to increase security. Before, the parser created network connections
to fetch remote files or loaded local files from the file system for DTD
and entities.
Signed-off-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue17239
Diffstat (limited to 'Lib/test/test_pulldom.py')
-rw-r--r-- | Lib/test/test_pulldom.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py index f454098..4a1bad3 100644 --- a/Lib/test/test_pulldom.py +++ b/Lib/test/test_pulldom.py @@ -3,6 +3,7 @@ import unittest import xml.sax from xml.sax.xmlreader import AttributesImpl +from xml.sax.handler import feature_external_ges from xml.dom import pulldom from test.support import findfile @@ -166,6 +167,12 @@ class PullDOMTestCase(unittest.TestCase): # This should have returned 'END_ELEMENT'. self.assertEqual(parser[-1][0], pulldom.START_DOCUMENT) + def test_external_ges_default(self): + parser = pulldom.parseString(SMALL_SAMPLE) + saxparser = parser.parser + ges = saxparser.getFeature(feature_external_ges) + self.assertEqual(ges, False) + class ThoroughTestCase(unittest.TestCase): """Test the hard-to-reach parts of pulldom.""" |