23
23
import os
24
24
import signal
25
25
import socket
26
- import subprocess
26
+
27
+ # Subprocess is needed to start the backend. But
28
+ # the input is controlled by the library. Excluding bandit check.
29
+ import subprocess # nosec B404
27
30
28
31
from ansys .tools .path import get_available_ansys_installations , get_latest_ansys_installation
29
32
from beartype .typing import TYPE_CHECKING , Dict , List
@@ -302,7 +305,7 @@ def prepare_and_start_backend(
302
305
LOG .debug (f"Args: { args } " )
303
306
LOG .debug (f"Environment variables: { env_copy } " )
304
307
305
- instance = ProductInstance (_start_program (args , env_copy ).pid )
308
+ instance = ProductInstance (__start_program (args , env_copy ).pid )
306
309
307
310
# Verify that the backend is ready to accept connections
308
311
# before returning the Modeler instance.
@@ -403,7 +406,7 @@ def _manifest_path_provider(
403
406
raise RuntimeError (msg )
404
407
405
408
406
- def _start_program (args : List [str ], local_env : Dict [str , str ]) -> subprocess .Popen :
409
+ def __start_program (args : List [str ], local_env : Dict [str , str ]) -> subprocess .Popen :
407
410
"""
408
411
Start the program where the path is the first item of the ``args`` array argument.
409
412
@@ -420,7 +423,8 @@ def _start_program(args: List[str], local_env: Dict[str, str]) -> subprocess.Pop
420
423
subprocess.Popen
421
424
The subprocess object.
422
425
"""
423
- return subprocess .Popen (
426
+ # private method and controlled input by library - excluding bandit check.
427
+ return subprocess .Popen ( # nosec B603
424
428
args ,
425
429
stdin = subprocess .DEVNULL ,
426
430
stdout = subprocess .DEVNULL ,
0 commit comments