T08 · Insecure Dependencies
- Location
scripts/compress_videos.py:21- Finding
Automatic Installation of an Unpinned Dependency from a Third-Party Package Index
- Content
View full analysis
Vulnerability Details
File Location:
scripts/compress_videos.py:21-25
Vulnerability Type: Insecure runtime dependency installation
Risk Level: MediumVulnerable Code
python try: from tqdm import tqdm except ImportError: print("正在安装依赖库 tqdm...") subprocess.run([sys.executable, "-m", "pip", "install", "tqdm", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple"], capture_output=True) from tqdm import tqdmThe related dependency declaration in
requirements.txt:1is also not pinned to an exact version:text tqdm>=4.60.0Technical Analysis
When
tqdmis unavailable, merely launching the compression script causes it to invokepipand install the latest resolvable version of the package from a third-party PyPI mirror. The installation command neither pins an exact audited version nor verifies package hashes.This makes the code executed by the Skill mutable after review. If the configured mirror, an upstream package release, DNS or network path, or package-resolution process is compromised, attacker-controlled package installation or import-time code could execute under the identity running the Skill.
Although the package name is a known dependency rather than an apparent typosquat, automatic installation from an external source without integrity controls is an unsafe supply-chain practice.
Attack Path
- A user or Agent launches
scripts/compress_videos.py. - The environment does not have an importable
tqdmpackage. - The
ImportErrorhandler automatically runs:bash python -m pip install tqdm -i https://pypi.tuna.tsinghua.edu.cn/simple - Pip resolves and downloads mutable package content without an exact version or required hashes.
- A compromised package source or distribution supplies malicious code.
- Installation hooks or the subsequent
from tqdm import tqdmexecute that code with the current process user's privileges.
Impact Assessment
Su ...[truncated 614 chars]
- A user or Agent launches
- Remediation
View remediation
Remediation Suggestions
- Remove the runtime
pip installoperation. Iftqdmis unavailable, exit with a clear dependency-installation error or continue without optional progress reporting. - Install dependencies as a separate, explicit deployment step before executing the Skill.
- Pin
tqdmto a reviewed exact version rather than usingtqdm>=4.60.0. - Use a lock file or hash-checked requirements file, for example with pip's
--require-hashes. - Retrieve packages only from an organization-approved repository or a trusted package index with appropriate integrity and access controls.
- Build and test the Skill in an isolated virtual environment or container with preinstalled dependencies.
- If automatic installation is unavoidable, require explicit user consent, pin the exact version, enforce hashes, and surface installation failures rather than suppressing pip output.
- Remove the runtime
