T08 · Insecure Dependencies
- Location
install.sh:37- Finding
Unpinned and Unnecessary Third-Party Dependencies Increase Supply-Chain Exposure
- Content
View full analysis
Vulnerability Details
File Location:
install.sh:37-39;requirements.txt:1-11
Vulnerability Type: Unpinned dependency installation
Risk Level: MediumVulnerable Code
install.sh:37-39:bash if [[ -f "requirements.txt" ]]; then pip install -r requirements.txt echo "✓ 依赖安装完成"requirements.txt:1-11:text pypdf2>=3.0.0 python-docx>=0.8.11 pyyaml>=6.0 jinja2>=3.1.0 openai>=1.0.0 pandas>=2.0.0 openpyxl>=3.1.0 rich>=13.0.0 pydantic>=2.0.0 loguru>=0.7.0 click>=8.1.0Technical Analysis
The installation script installs dependencies directly from the package index using mutable lower-bound constraints. There is no lockfile, exact version pinning, hash verification, or configured package-index restriction.
Constraints such as
openai>=1.0.0allow any future version satisfying the lower bound to be installed. Consequently, two installations performed at different times can execute materially different third-party installation and runtime code, even when the audited project itself has not changed.The audit also found no imports of
openai,pandas,openpyxl,jinja2,rich,pydantic, orclickin the project. Installing these unused packages unnecessarily expands the number of package maintainers, transitive dependencies, and installation hooks that must be trusted.This finding does not establish that any listed package is currently malicious. The vulnerability is the absence of reproducible dependency controls and the unnecessary expansion of the dependency attack surface.
Attack Path
- A user executes
install.sh. - The script invokes
pip install -r requirements.txt. - The package resolver selects the newest releases satisfying the open-ended
>=constraints. - If an allowed package release or one of its transitive dependencies has been compromised, its installation or imported runtime code executes.
- That code runs w ...[truncated 624 chars]
- A user executes
- Remediation
View remediation
Remediation Suggestions
- Remove dependencies that are not imported or otherwise required, particularly
openai,pandas,openpyxl,jinja2,rich,pydantic, andclick. - Pin every direct dependency to an exact, reviewed version instead of using unrestricted lower bounds.
- Generate a lockfile that records all transitive dependency versions.
- Use hash verification, such as a requirements file generated with hashes and installed using
pip install --require-hashes. - Configure an approved package index or internal mirror rather than implicitly trusting every package source configured in the environment.
- Install dependencies inside a dedicated virtual environment with minimal filesystem and credential access.
- Add automated dependency vulnerability and provenance scanning to the release process.
- Review and deliberately update pinned dependencies on a controlled schedule.
- Remove dependencies that are not imported or otherwise required, particularly
