GRM-24: fix: resolve bandit security warnings in source code and tests

This commit is contained in:
Emil Simeonov
2026-06-19 21:13:42 +02:00
parent e9c0f22fc0
commit ae27417a5f
5 changed files with 17 additions and 17 deletions
+6 -6
View File
@@ -5,7 +5,7 @@ from __future__ import annotations
import logging
import os
import re
import subprocess
import subprocess # nosec B404
import sys
from datetime import datetime
from pathlib import Path
@@ -62,14 +62,14 @@ class AnsibleExecutor:
"""Execute command, streaming stdout+stderr to log file. Returns exit code."""
env = os.environ.copy()
with open(log_file, "a") as f:
proc = subprocess.Popen(
proc = subprocess.Popen( # nosec B603
cmd,
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
assert proc.stdout is not None
assert proc.stdout is not None # nosec B101
try:
for line in proc.stdout:
f.write(line)
@@ -108,7 +108,7 @@ class AnsibleExecutor:
cmd.append("--ask-become-pass")
env = os.environ.copy()
proc = subprocess.run(
proc = subprocess.run( # nosec B603
cmd,
env=env,
capture_output=True,
@@ -137,6 +137,6 @@ class AnsibleExecutor:
)
if match:
return match.group(1).replace("\\n", " ").strip()
except Exception:
pass
except OSError:
return None
return None