fix: stabilize tests with synchronous DB init and handle Bandit security findings

This commit is contained in:
2026-04-09 01:33:15 -04:00
parent 8c7ec2953e
commit 13f3d15a36
48 changed files with 121 additions and 88 deletions

View File

@@ -4,7 +4,7 @@ Handles dynamic rotation of exposed honeypot services over time.
"""
import random
import subprocess
import subprocess # nosec B404
import time
from pathlib import Path
from typing import Optional
@@ -29,7 +29,7 @@ def _compose_with_retry(
last_exc: subprocess.CalledProcessError | None = None
cmd = ["docker", "compose", "-f", str(compose_file), *args]
for attempt in range(1, retries + 1):
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True) # nosec B603
if result.returncode == 0:
if result.stdout:
print(result.stdout, end="")
@@ -78,8 +78,8 @@ def mutate_decky(decky_name: str) -> bool:
attempts = 0
while True:
count = random.randint(1, min(3, len(svc_pool)))
chosen = set(random.sample(svc_pool, count))
count = random.randint(1, min(3, len(svc_pool))) # nosec B311
chosen = set(random.sample(svc_pool, count)) # nosec B311
attempts += 1
if chosen != current_services or attempts > 20:
break