T08 · Insecure Dependencies
- Location
scripts/export_long_image.py:14- Finding
Automatic Installation of Unpinned Runtime Dependencies
- Content
View full analysis
None: ensure_commands = [ [sys.executable, "-m", "ensurepip", "--upgrade"], ] install_commands = [ [sys.executable, "-m", "pip", "install", package_name], ] uv_path = shutil.which("uv") if uv_path: install_commands.append([uv_path, "pip", "install", "--python", sys.executable, package_name]) for ensure_command in ensure_commands: subprocess.run(ensure_command, check=False) last_error: Exception | None = None for command in install_commands: try: subprocess.run(command, check=True) return except Exception as exc: # noqa: BLE001 last_error = exc if last_error is not None: raise last_error ``` ```python def ensure_playwright_module() -> None: try: importlib.import_module("playwright.sync_api") return except ImportError: pass _run_install("playwright") importlib.import_module("playwright.sync_api") def install_playwright_browser() -> None: subprocess.run( [sys.executable, "-m", "playwright", "install", "chromium"], check=True, ) def ensure_pillow() -> None: try: importlib.import_module("PIL.Image") return except ImportError: pass _run_install("pillow") importlib.import_module("PIL.Image") ``` The renderer contains an equivalent installer in `scripts/render_markdown_mobile_long_image.py`: ```python def _run_install(package_name: str) -> None: ensure_commands = [ [sys.executable, "-m", "ensurepip", "--upgrade"], ] install_commands = [ ...[truncated 3013 chars]- Remediation
View remediation
