Add security layer to send file output things (#8189)
* Add security layer to send file output things * Make telegram secure * fix lint * fix handling * invert check * resolve relative paths * add test for relative paths * fix lint * fix tests * Address paulus comments * fix style * fix tests * Add more tests * fix tests * fix tests * fix test p2 * fix lint * fix tests * Make it available for windows * Change name / address comments * fix set * fix test * fix tests * fix test * fix lint
This commit is contained in:
1 parent
2f2952e0ec
commit
2dd7f0616e
8 files changed
+86
-6
No files matched your search
+12
-2
@@ -16,7 +16,8 @@ from homeassistant.const import (
|
||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_PACKAGES, CONF_UNIT_SYSTEM,
|
||||
CONF_TIME_ZONE, CONF_ELEVATION, CONF_UNIT_SYSTEM_METRIC,
|
||||
CONF_UNIT_SYSTEM_IMPERIAL, CONF_TEMPERATURE_UNIT, TEMP_CELSIUS,
|
||||
__version__, CONF_CUSTOMIZE, CONF_CUSTOMIZE_DOMAIN, CONF_CUSTOMIZE_GLOB)
|
||||
__version__, CONF_CUSTOMIZE, CONF_CUSTOMIZE_DOMAIN, CONF_CUSTOMIZE_GLOB,
|
||||
CONF_WHITELIST_EXTERNAL_DIRS)
|
||||
from homeassistant.core import callback, DOMAIN as CONF_CORE
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.loader import get_component, get_platform
|
||||
@@ -38,7 +39,7 @@ DATA_CUSTOMIZE = 'hass_customize'
|
||||
|
||||
FILE_MIGRATION = [
|
||||
["ios.conf", ".ios.conf"],
|
||||
]
|
||||
]
|
||||
|
||||
DEFAULT_CORE_CONFIG = (
|
||||
# Tuples (attribute, default, auto detect property, description)
|
||||
@@ -130,6 +131,9 @@ CORE_CONFIG_SCHEMA = CUSTOMIZE_CONFIG_SCHEMA.extend({
|
||||
vol.Optional(CONF_TEMPERATURE_UNIT): cv.temperature_unit,
|
||||
CONF_UNIT_SYSTEM: cv.unit_system,
|
||||
CONF_TIME_ZONE: cv.time_zone,
|
||||
vol.Optional(CONF_WHITELIST_EXTERNAL_DIRS):
|
||||
# pylint: disable=no-value-for-parameter
|
||||
vol.All(cv.ensure_list, [vol.IsDir()]),
|
||||
vol.Optional(CONF_PACKAGES, default={}): PACKAGES_CONFIG_SCHEMA,
|
||||
})
|
||||
|
||||
@@ -366,6 +370,12 @@ def async_process_ha_core_config(hass, config):
|
||||
if CONF_TIME_ZONE in config:
|
||||
set_time_zone(config.get(CONF_TIME_ZONE))
|
||||
|
||||
# init whitelist external dir
|
||||
hac.whitelist_external_dirs = set((hass.config.path('www'),))
|
||||
if CONF_WHITELIST_EXTERNAL_DIRS in config:
|
||||
hac.whitelist_external_dirs.update(
|
||||
set(config[CONF_WHITELIST_EXTERNAL_DIRS]))
|
||||
|
||||
# Customize
|
||||
cust_exact = dict(config[CONF_CUSTOMIZE])
|
||||
cust_domain = dict(config[CONF_CUSTOMIZE_DOMAIN])
|
||||
|
||||
Reference in new issue
Block a user