OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Address Bandit B404 subprocess findings in GitHub Actions Python (#37655)
Andrey Babushkin6eea050a4a0b
diff --git a/.github/actions/coverage_toolkit/collect_cpp_coverage.py b/.github/actions/coverage_toolkit/collect_cpp_coverage.pyindex f03de1eb248..eadf8bb64e9 100644--- a/.github/actions/coverage_toolkit/collect_cpp_coverage.py+++ b/.github/actions/coverage_toolkit/collect_cpp_coverage.py@@ -7,7 +7,8 @@ import osimport reimport shleximport shutil-import subprocess+# Coverage CI: fixed toolchain argv (lcov/gcov/genhtml), no shell.+import subprocess # nosec B404from pathlib import Pathfrom coverage_workflow import CoverageContext, LOGGER, run_cmddiff --git a/.github/actions/coverage_toolkit/coverage.py b/.github/actions/coverage_toolkit/coverage.pyindex 1e35a8937b6..45b302fbdce 100644--- a/.github/actions/coverage_toolkit/coverage.py+++ b/.github/actions/coverage_toolkit/coverage.py@@ -11,7 +11,8 @@ import loggingimport osfrom pathlib import Pathimport shlex-import subprocess+# Coverage CI: run_cmd uses argv lists with shell=False unless explicitly opted in.+import subprocess # nosec B404import sysfrom typing import Anydiff --git a/.github/actions/coverage_toolkit/run_tests.py b/.github/actions/coverage_toolkit/run_tests.pyindex eb099cc985d..81137f009d9 100644--- a/.github/actions/coverage_toolkit/run_tests.py+++ b/.github/actions/coverage_toolkit/run_tests.py@@ -9,7 +9,8 @@ import osfrom pathlib import Pathimport shleximport shutil-import subprocess+# Coverage CI: pytest/coverage/python invoked as argv lists in the workflow workspace.+import subprocess # nosec B404import timeimport xml.etree.ElementTree as ETdiff --git a/.github/scripts/agentic-workflows/remediate_transient_failure.py b/.github/scripts/agentic-workflows/remediate_transient_failure.pyindex eaad7807857..03fe96ca785 100644--- a/.github/scripts/agentic-workflows/remediate_transient_failure.py+++ b/.github/scripts/agentic-workflows/remediate_transient_failure.py@@ -25,7 +25,8 @@ because the default token cannot re-trigger ``merge_group`` check runs.from __future__ import annotationsimport os-import subprocess+# Merge-queue remediation: gh called with a fixed argv; PR/repo ids validated in common.py.+import subprocess # nosec B404from common import (github_client,diff --git a/.github/scripts/meat/build_report.py b/.github/scripts/meat/build_report.pyindex 18e6578eb00..2b6568b2ea5 100644--- a/.github/scripts/meat/build_report.py+++ b/.github/scripts/meat/build_report.py@@ -27,7 +27,8 @@ Output files:import jsonimport osimport pathlib-import subprocess+# Posts report via gh using argv lists; comment body is passed as a dedicated argument.+import subprocess # nosec B404import sysimport textwrapdiff --git a/.github/scripts/meat/create_agent_pr.py b/.github/scripts/meat/create_agent_pr.pyindex bd41bf67730..d274cd6ae28 100644--- a/.github/scripts/meat/create_agent_pr.py+++ b/.github/scripts/meat/create_agent_pr.py@@ -22,7 +22,8 @@ Exit codes:import argparseimport jsonimport pathlib-import subprocess+# Agent PR helper: git/gh invoked as argv lists; no shell string composition.+import subprocess # nosec B404import sysimport textwrapdiff --git a/.github/scripts/meat/enable_operator.py b/.github/scripts/meat/enable_operator.pyindex 630c97545b6..3c4b7546d13 100644--- a/.github/scripts/meat/enable_operator.py+++ b/.github/scripts/meat/enable_operator.py@@ -33,7 +33,8 @@ Shortcut for: run_agent.py enable-operator <context-file>"""import os-import subprocess+# Thin wrapper: re-execs run_agent.py via sys.executable and a fixed script path (no shell).+import subprocess # nosec B404import sysdiff --git a/.github/scripts/meat/install_copilot_env.py b/.github/scripts/meat/install_copilot_env.pyindex 35149a4b804..021405e7289 100644--- a/.github/scripts/meat/install_copilot_env.py+++ b/.github/scripts/meat/install_copilot_env.py@@ -18,7 +18,8 @@ import jsonimport osimport platformimport shutil-import subprocess+# Local setup helper: subprocess.run on fixed installer/version-check argv from this script only.+import subprocess # nosec B404import sysfrom pathlib import Pathfrom typing import Optionaldiff --git a/.github/scripts/meat/run_agent.py b/.github/scripts/meat/run_agent.pyindex 58de781b6c0..25bf8cfe74d 100644--- a/.github/scripts/meat/run_agent.py+++ b/.github/scripts/meat/run_agent.py@@ -20,7 +20,8 @@ Copilot CLI reference:"""import os-import subprocess+# Runs the copilot CLI with fixed flags; prompt is a separate -p argument, not a shell command.+import subprocess # nosec B404import sysAGENTS = [diff --git a/.github/scripts/meat/tests/conftest.py b/.github/scripts/meat/tests/conftest.pyindex c3a2b92488f..766a7b55d51 100644--- a/.github/scripts/meat/tests/conftest.py+++ b/.github/scripts/meat/tests/conftest.py@@ -20,7 +20,8 @@ SCRIPTS_DIR = pathlib.Path(__file__).parent.parentdef run_script(script: pathlib.Path, cwd, *args, extra_env=None):"""Run a Python script as a subprocess, return CompletedProcess."""- import subprocess+ # Test harness only: sys.executable + script path argv, no shell.+ import subprocess # nosec B404env = os.environ.copy()if extra_env: