T08 · Insecure Dependencies
Warning
- Location
- scripts/render_page.py:35
- Finding
- Unpinned Runtime Dependency and Browser Installation## Vulnerability Details **File Location**: `scripts/render_page.py`, lines 35–42 **Vulnerability Type**: Unpinned third-party dependency installation at runtime **Risk Level**: Medium ### Vulnerable Code ```python def ensure_playwright(): """Ensure playwright and browsers are installed.""" try: from playwright.sync_api import sync_playwright return True except ImportError: print("Installing playwright...") import subprocess subprocess.run([sys.executable, "-m", "pip", "install", "playwright"], check=True) subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"], check=True) return True ``` ### Technical Analysis When Playwright is unavailable, the screenshot utility automatically installs the latest version of the unpinned `playwright` package from pip and then downloads a Chromium binary. Neither artifact is constrained by a reviewed lock file, exact version, cryptographic hash, or equivalent integrity verification. Consequently, the code executed by this reviewed project may change whenever the script is run. A compromised package registry, upstream release, distribution path, or browser artifact could introduce attacker-controlled code. Installation and subsequent imports occur with the same operating-system identity and permissions as the user or agent running the Skill. This is a supply-chain weakness rather than evidence that the current Playwright package is malicious. ### Attack Path 1. An agent or user invokes `scripts/render_page.py` in an environment where Playwright is not installed. 2. Importing `playwright.sync_api` raises `ImportError`. 3. `ensure_playwright()` executes `python -m pip install playwright` without a version or hash constraint. 4. pip retrieves mutable package content from its configured package source. 5. The script executes `python -m playwright install chromium`, retrieving an additional browser artifact without project-level integrity ...[truncated 918 chars]
- Remediation
- ## Remediation Suggestions 1. Remove automatic dependency installation from `ensure_playwright()` and fail with a clear setup error when Playwright is unavailable. 2. Declare an exact, reviewed Playwright version in a dependency lock file. 3. Generate and enforce cryptographic package hashes, such as by installing from a requirements file with `pip install --require-hashes`. 4. Pin the Chromium/browser revision compatible with the reviewed Playwright release and verify downloaded artifacts against trusted checksums. 5. Install dependencies during a controlled build or provisioning phase rather than during normal script execution. 6. Use a trusted internal package mirror or restricted package index where practical. 7. Run rendering in a sandbox or container with minimal filesystem access, restricted network access, no unnecessary credentials, and a non-privileged user. 8. Include dependency and browser artifacts in routine supply-chain scanning and update them through an explicit review process.
