using defusedxml ElementTree for safer parsing of untrusted XML data (#9934)

* using defusexml ElementTree for safer parsing of untrusted XML data

* move from core dependency to platform specific dependency

* style difference: put back end of list comma in setup.py
This commit is contained in:
Daniel Welch 2017-10-18 10:21:46 -04:00 committed by Pascal Vizeli
parent 587948ec06
commit 1bec2c005d
4 changed files with 11 additions and 1 deletions

View File

@ -6,7 +6,6 @@ https://home-assistant.io/components/device_tracker.upc_connect/
""" """
import asyncio import asyncio
import logging import logging
import xml.etree.ElementTree as ET
import aiohttp import aiohttp
import async_timeout import async_timeout
@ -19,6 +18,8 @@ from homeassistant.const import CONF_HOST
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
REQUIREMENTS = ['defusedxml==0.5.0']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEFAULT_IP = '192.168.0.1' DEFAULT_IP = '192.168.0.1'
@ -63,6 +64,8 @@ class UPCDeviceScanner(DeviceScanner):
@asyncio.coroutine @asyncio.coroutine
def async_scan_devices(self): def async_scan_devices(self):
"""Scan for new devices and return a list with found device IDs.""" """Scan for new devices and return a list with found device IDs."""
import defusedxml.ElementTree as ET
if self.token is None: if self.token is None:
token_initialized = yield from self.async_initialize_token() token_initialized = yield from self.async_initialize_token()
if not token_initialized: if not token_initialized:

View File

@ -177,6 +177,9 @@ datapoint==0.4.3
# homeassistant.components.light.decora_wifi # homeassistant.components.light.decora_wifi
# decora_wifi==1.3 # decora_wifi==1.3
# homeassistant.components.device_tracker.upc_connect
defusedxml==0.5.0
# homeassistant.components.media_player.denonavr # homeassistant.components.media_player.denonavr
denonavr==0.5.4 denonavr==0.5.4

View File

@ -36,6 +36,9 @@ aiohttp_cors==0.5.3
# homeassistant.components.notify.apns # homeassistant.components.notify.apns
apns2==0.1.1 apns2==0.1.1
# homeassistant.components.device_tracker.upc_connect
defusedxml==0.5.0
# homeassistant.components.sensor.dsmr # homeassistant.components.sensor.dsmr
dsmr_parser==0.11 dsmr_parser==0.11

View File

@ -37,6 +37,7 @@ TEST_REQUIREMENTS = (
'aioautomatic', 'aioautomatic',
'aiohttp_cors', 'aiohttp_cors',
'apns2', 'apns2',
'defusedxml',
'dsmr_parser', 'dsmr_parser',
'ephem', 'ephem',
'evohomeclient', 'evohomeclient',