T08 · Insecure Dependencies
- Location
scripts/render_page.py:35- Finding
Unpinned Runtime Dependency and Browser Installation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/render_page.py, lines 35–42
Vulnerability Type: Unpinned third-party dependency installation at runtime
Risk Level: MediumVulnerable 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 TrueTechnical Analysis
When Playwright is unavailable, the screenshot utility automatically installs the latest version of the unpinned
playwrightpackage 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
- An agent or user invokes
scripts/render_page.pyin an environment where Playwright is not installed. - Importing
playwright.sync_apiraisesImportError. ensure_playwright()executespython -m pip install playwrightwithout a version or hash constraint.- pip retrieves mutable package content from its configured package source.
- The script executes
python -m playwright install chromium, retrieving an additional browser artifact without project-level integrity ...[truncated 918 chars]
- An agent or user invokes
- Remediation
View remediation
Remediation Suggestions
- Remove automatic dependency installation from
ensure_playwright()and fail with a clear setup error when Playwright is unavailable. - Declare an exact, reviewed Playwright version in a dependency lock file.
- Generate and enforce cryptographic package hashes, such as by installing from a requirements file with
pip install --require-hashes. - Pin the Chromium/browser revision compatible with the reviewed Playwright release and verify downloaded artifacts against trusted checksums.
- Install dependencies during a controlled build or provisioning phase rather than during normal script execution.
- Use a trusted internal package mirror or restricted package index where practical.
- Run rendering in a sandbox or container with minimal filesystem access, restricted network access, no unnecessary credentials, and a non-privileged user.
- Include dependency and browser artifacts in routine supply-chain scanning and update them through an explicit review process.
- Remove automatic dependency installation from
