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ä authored and GitHub committed 2020-01-20 18:44:55 +02:00
1 parent 6cf20fc7fa
commit 5e2ba2eb77
21 files changed
+110 -91

No files matched your search

@@ -91,7 +91,7 @@ class CommandCover(CoverDevice):
"""Execute the actual commands."""
_LOGGER.info("Running command: %s", command)
success = subprocess.call(command, shell=True) == 0
success = subprocess.call(command, shell=True) == 0 # nosec # shell by design
if not success:
_LOGGER.error("Command failed: %s", command)
@@ -104,7 +104,9 @@ class CommandCover(CoverDevice):
_LOGGER.info("Running state command: %s", command)
try:
return_value = subprocess.check_output(command, shell=True)
return_value = subprocess.check_output(
command, shell=True # nosec # shell by design
)
return return_value.strip().decode("utf-8")
except subprocess.CalledProcessError:
_LOGGER.error("Command failed: %s", command)