Add bandit, use to catch known vulnerable XML parsing (#28341)

* Add bandit to pre-commit and CI, use to catch known vulnerable XML parsing

* Use defusedxml instead of direct xml.etree to parse XML

* Move config to tests/bandit.yaml
This commit is contained in:
Ville Skyttä authored and Pascal Vizeli committed 2019-11-18 09:10:15 +01:00
1 parent aef808d2bf
commit d4c80f160c
13 files changed
+42 -3

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ class TestEmulatedHue(unittest.TestCase):
def test_description_xml(self):
"""Test the description."""
import xml.etree.ElementTree as ET
import defusedxml.ElementTree as ET
result = requests.get(BRIDGE_URL_BASE.format("/description.xml"), timeout=5)
@@ -1,7 +1,7 @@
"""The tests for the rss_feed_api component."""
import asyncio
from xml.etree import ElementTree
from defusedxml import ElementTree
import pytest
from homeassistant.setup import async_setup_component