T08 · Insecure Dependencies
- Location
douyin_keyword_search.py:44- Finding
Unpinned and Unverified Runtime Dependency Installation
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1;douyin_keyword_search.py:44-50
Vulnerability Type: Supply-chain exposure through mutable dependencies and runtime installation
Risk Level: MediumVulnerable Code
requirements.txt:1text playwright>=1.40.0douyin_keyword_search.py:44-50python def install_dependencies(): """安装依赖""" print("正在安装 Playwright...") os.system(f'"{sys.executable}" -m pip install playwright') os.system(f'"{sys.executable}" -m playwright install chromium') print("依赖安装完成,请重新运行脚本") sys.exit(0)Technical Analysis
The dependency specification permits any Playwright release equal to or newer than version 1.40.0. The fallback installation routine is even less constrained, installing
playwrightwithout specifying a version. It then downloads and installs a Chromium browser build at runtime.No lock file, package hash, browser revision verification, or trusted artifact policy is present. Consequently, the effective code and browser binaries executed by the Skill can change after the Skill itself has been reviewed.
The package name is legitimate, and the reviewed code does not specify an obviously malicious repository. This finding concerns supply-chain integrity rather than evidence that the current Playwright package is malicious.
Attack Path
- A user follows the installation instructions or runs the Skill without Playwright installed.
- The Skill offers to invoke
pip install playwright. - The package manager resolves the latest package satisfying the mutable dependency constraint.
- Playwright subsequently downloads a compatible Chromium build.
- If the package index, resolved release, distribution channel, account, or downloaded browser artifact is compromised, attacker-controlled code can execute during installation or later browser startup.
- That code runs under the same operating-system account and privileges as the user invoking the Skil ...[truncated 485 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin Playwright to an explicitly reviewed version, for example
playwright==<audited-version>. - Generate a lock file containing cryptographic hashes and install with hash verification, such as
pip install --require-hashes. - Pin and document the corresponding Playwright browser revision.
- Obtain Python packages and browser artifacts only from approved, authenticated repositories.
- Verify downloaded artifact checksums or signatures before installation.
- Remove automatic dependency installation from normal runtime behavior. Fail safely and direct users to a separate, reviewable setup procedure.
- Check return codes for every installation command and abort on failure.
- Run installation and browser automation in a least-privileged virtual environment or isolated container.
- Pin Playwright to an explicitly reviewed version, for example
