T08 · Insecure Dependencies
- Location
install_playwright_docker.py:30- Finding
Unpinned Dependencies and Unofficial Browser Binary Mirrors
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1;install.sh:41-42;install_playwright_docker.py:30-37
Vulnerability Type: Supply-chain exposure through unpinned dependencies and unsafe download sources
Risk Level: MediumComplete Code Snippets
requirements.txt:1text playwright>=1.40.0install.sh:41-42bash pip install --upgrade pip pip install playwrightinstall_playwright_docker.py:30-37python env = os.environ.copy() env.setdefault("PLAYWRIGHT_DOWNLOAD_HOST", "https://npmmirror.com/mirrors/playwright") env.setdefault("PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST", "https://cdn.npmmirror.com/binaries/chrome-for-testing") venv_python = Path("venv/bin/python") venv_pip = Path("venv/bin/pip") if not venv_python.exists(): run([sys.executable, "-m", "venv", "venv"]) run([str(venv_pip), "install", "-r", "requirements.txt"], env=env) run([str(venv_python), "-m", "playwright", "install", "chromium"], env=env)Technical Analysis
The Python dependency specification accepts every Playwright release at or above version 1.40.0 rather than selecting a reviewed, reproducible version. The primary installer independently installs the latest available Playwright package and upgrades
pip, also without integrity constraints.The native installation path additionally redirects Playwright and Chromium downloads to third-party mirror domains. No checksum, signature, hash-locked requirements file, or other artifact verification is performed before downloaded code and browser binaries are installed and executed.
This creates a supply-chain risk: dependency resolution may change between installations, and compromise of a package publisher, registry, mirror, or distribution path could substitute malicious package content or a browser executable.
Attack Path
- An attacker compromises a configured mirror, relevant package publisher, registry account, or dependency distribution path.
- The attacker publishes or ...[truncated 1080 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin Playwright to a reviewed exact version, for example
playwright==1.50.0, and update it through a controlled process. - Generate a hash-locked requirements file and install with
pip install --require-hashes -r requirements.txt. - Avoid upgrading
pipimplicitly during normal project installation; pin and manage installer tooling separately. - Use official Playwright browser distribution endpoints instead of third-party mirrors.
- If a mirror is operationally necessary, verify every downloaded artifact against a checksum or signature obtained through an independent trusted channel.
- Pin container image references by immutable digest rather than a mutable tag.
- Add Node.js package metadata and a committed lockfile if the Node implementation remains supported, and use
npm cirather than unrestrictednpm installornpx. - Run dependency installation as an unprivileged account in an isolated build environment.
- Pin Playwright to a reviewed exact version, for example
