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:
parent
6cf20fc7fa
commit
5e2ba2eb77
21 changed files with 110 additions and 91 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue