Enable some more bandit checks (#30857)

* Enable B108 (hardcoded tmp dir), address findings

* Enable B602 (subprocess popen with shell), address findings

* Enable B604 (start process with shell), address findings

* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
This commit is contained in:
Ville Skyttä
2020-01-20 18:44:55 +02:00
committed by GitHub
parent 6cf20fc7fa
commit 5e2ba2eb77
21 changed files with 110 additions and 91 deletions

View File

@@ -347,7 +347,7 @@ async def test_loading_configuration_from_storage(hass, hass_storage):
"version": 1,
}
await config_util.async_process_ha_core_config(
hass, {"whitelist_external_dirs": "/tmp"}
hass, {"whitelist_external_dirs": "/etc"}
)
assert hass.config.latitude == 55
@@ -357,7 +357,7 @@ async def test_loading_configuration_from_storage(hass, hass_storage):
assert hass.config.units.name == CONF_UNIT_SYSTEM_METRIC
assert hass.config.time_zone.zone == "Europe/Copenhagen"
assert len(hass.config.whitelist_external_dirs) == 2
assert "/tmp" in hass.config.whitelist_external_dirs
assert "/etc" in hass.config.whitelist_external_dirs
assert hass.config.config_source == SOURCE_STORAGE
@@ -377,7 +377,7 @@ async def test_updating_configuration(hass, hass_storage):
}
hass_storage["core.config"] = dict(core_data)
await config_util.async_process_ha_core_config(
hass, {"whitelist_external_dirs": "/tmp"}
hass, {"whitelist_external_dirs": "/etc"}
)
await hass.config.async_update(latitude=50)
@@ -402,7 +402,7 @@ async def test_override_stored_configuration(hass, hass_storage):
"version": 1,
}
await config_util.async_process_ha_core_config(
hass, {"latitude": 60, "whitelist_external_dirs": "/tmp"}
hass, {"latitude": 60, "whitelist_external_dirs": "/etc"}
)
assert hass.config.latitude == 60
@@ -412,7 +412,7 @@ async def test_override_stored_configuration(hass, hass_storage):
assert hass.config.units.name == CONF_UNIT_SYSTEM_METRIC
assert hass.config.time_zone.zone == "Europe/Copenhagen"
assert len(hass.config.whitelist_external_dirs) == 2
assert "/tmp" in hass.config.whitelist_external_dirs
assert "/etc" in hass.config.whitelist_external_dirs
assert hass.config.config_source == config_util.SOURCE_YAML
@@ -427,7 +427,7 @@ async def test_loading_configuration(hass):
"name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "America/New_York",
"whitelist_external_dirs": "/tmp",
"whitelist_external_dirs": "/etc",
},
)
@@ -438,7 +438,7 @@ async def test_loading_configuration(hass):
assert hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL
assert hass.config.time_zone.zone == "America/New_York"
assert len(hass.config.whitelist_external_dirs) == 2
assert "/tmp" in hass.config.whitelist_external_dirs
assert "/etc" in hass.config.whitelist_external_dirs
assert hass.config.config_source == config_util.SOURCE_YAML