2323import os
2424import signal
2525import 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
2730
2831from ansys .tools .path import get_available_ansys_installations , get_latest_ansys_installation
2932from beartype .typing import TYPE_CHECKING , Dict , List
@@ -238,7 +241,7 @@ def prepare_and_start_backend(
238241 LOG .debug (f"Args: { args } " )
239242 LOG .debug (f"Environment variables: { env_copy } " )
240243
241- instance = ProductInstance (_start_program (args , env_copy ).pid )
244+ instance = ProductInstance (__start_program (args , env_copy ).pid )
242245
243246 return Modeler (
244247 host = host , port = port , timeout = timeout , product_instance = instance , backend_type = backend_type
@@ -278,7 +281,7 @@ def _manifest_path_provider(version: int, available_installations: Dict) -> str:
278281 )
279282
280283
281- def _start_program (args : List [str ], local_env : Dict [str , str ]) -> subprocess .Popen :
284+ def __start_program (args : List [str ], local_env : Dict [str , str ]) -> subprocess .Popen :
282285 """
283286 Start the program where the path is the first item of the ``args`` array argument.
284287
@@ -295,7 +298,8 @@ def _start_program(args: List[str], local_env: Dict[str, str]) -> subprocess.Pop
295298 subprocess.Popen
296299 The subprocess object.
297300 """
298- return subprocess .Popen (
301+ # private method and controlled input by library - excluding bandit check.
302+ return subprocess .Popen ( # nosec B603
299303 args ,
300304 stdin = subprocess .DEVNULL ,
301305 stdout = subprocess .DEVNULL ,
0 commit comments