T08 · Insecure Dependencies
- Location
requirements.txt:3- Finding
Unpinned Python dependencies permit installation of unreviewed package versions
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:3-7;scripts/setup_deps.sh:55-59
Vulnerability Type: Supply-chain exposure through open-ended dependency constraints
Risk Level: MediumVulnerable Code
requirements.txt:3-7:text torch>=2.0.0 open-clip-torch>=2.24.0 pillow>=10.0.0 numpy>=1.24.0 pillow-heif>=0.13.0 # optional: HEIC/HEIF support (iPhone/iPad). NOTE: GPLv2 licensedscripts/setup_deps.sh:55-59:bash if [[ "$answer" =~ ^[Yy]$ ]]; then echo "" echo "📦 安装 Python 依赖..." pip3 install "${MISSING_PY[@]}" echo -e "${GREEN}✓ Python 依赖安装完成${NC}"Technical Analysis
The dependency declaration uses open-ended lower bounds rather than exact, reviewed versions. A future release satisfying these constraints can therefore be installed without any corresponding review of this project.
The setup script further installs package names directly from the active package index. It does not use a lock file, require package hashes, constrain the package index, or install from the declared requirements file. Python packages can execute code during installation and whenever they are imported. Consequently, compromise of an accepted upstream release or the configured package index would affect the code executed under the invoking user's account.
This is a supply-chain hardening issue; the reviewed project does not itself contain evidence that any currently named dependency is malicious.
Attack Path
- An attacker compromises an upstream package release, package maintainer account, or package-index delivery path.
- The compromised version retains a version number accepted by the open-ended constraint, or is selected by the direct
pip3 installcommand. - A user follows the documented setup process and approves installation.
pip3downloads and installs the unreviewed package.- Malicious package code executes during in ...[truncated 600 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin every direct and transitive dependency to an exact, reviewed version using a generated lock file.
- Record and enforce cryptographic hashes, for example with
pip install --require-hashes -r requirements.lock. - Change
setup_deps.shto install exclusively from the locked requirements file rather than constructing a package-name list. - Use a dedicated virtual environment and avoid global or privileged installation.
- Configure an approved package index explicitly and apply dependency-update review and automated vulnerability scanning.
- Separate optional HEIC support into an optional, independently pinned dependency group.
- Regenerate pins and hashes only through a controlled dependency-update process.
