Skip to content

Commit

Permalink
using defusedxml ElementTree for safer parsing of untrusted XML data (h…
Browse files Browse the repository at this point in the history
…ome-assistant#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
  • Loading branch information
danielwelch authored and pvizeli committed Oct 18, 2017
1 parent 587948e commit 1bec2c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homeassistant/components/device_tracker/upc_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
import asyncio
import logging
import xml.etree.ElementTree as ET

import aiohttp
import async_timeout
Expand All @@ -19,6 +18,8 @@
from homeassistant.helpers.aiohttp_client import async_get_clientsession


REQUIREMENTS = ['defusedxml==0.5.0']

_LOGGER = logging.getLogger(__name__)

DEFAULT_IP = '192.168.0.1'
Expand Down Expand Up @@ -63,6 +64,8 @@ def __init__(self, hass, config):
@asyncio.coroutine
def async_scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
import defusedxml.ElementTree as ET

if self.token is None:
token_initialized = yield from self.async_initialize_token()
if not token_initialized:
Expand Down
3 changes: 3 additions & 0 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ datapoint==0.4.3
# homeassistant.components.light.decora_wifi
# decora_wifi==1.3

# homeassistant.components.device_tracker.upc_connect
defusedxml==0.5.0

# homeassistant.components.media_player.denonavr
denonavr==0.5.4

Expand Down
3 changes: 3 additions & 0 deletions requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ aiohttp_cors==0.5.3
# homeassistant.components.notify.apns
apns2==0.1.1

# homeassistant.components.device_tracker.upc_connect
defusedxml==0.5.0

# homeassistant.components.sensor.dsmr
dsmr_parser==0.11

Expand Down
1 change: 1 addition & 0 deletions script/gen_requirements_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'aioautomatic',
'aiohttp_cors',
'apns2',
'defusedxml',
'dsmr_parser',
'ephem',
'evohomeclient',
Expand Down

0 comments on commit 1bec2c0

Please sign in to comment.