T08 · Insecure Dependencies
- Location
requirements.txt:7- Finding
Unpinned and Unverified Python Dependency Installation
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:7,scripts/setup_deps.sh:84-90,SKILL.md:78-79
Vulnerability Type: Software supply-chain exposure through mutable dependency resolution
Risk Level: LowVulnerable Code
requirements.txt:7:text tomli>=1.1.0 ; python_version < "3.11"scripts/setup_deps.sh:84-90:bash else echo -e " ${YELLOW}⚠${NC} tomli — 未安装(Python < 3.11 需要)" echo " 安装中..." pip3 install tomli && echo -e " ${GREEN}✓${NC} tomli 安装完成" || { echo -e " ${RED}✗${NC} tomli 安装失败,请手动运行: pip3 install tomli" ALL_OK=false } fiSKILL.md:78-79:bash source .venv/bin/activate pip install -r photo-grader/requirements.txtTechnical Analysis
The dependency declaration provides only a lower version bound. It does not use an exact version, a lockfile, package hashes, or an explicitly trusted package index. Consequently, each installation can resolve to different upstream content.
The setup script compounds this exposure by invoking
pip3 install tomlidirectly. It does not require an activated virtual environment or usepython3 -m pip, so the package may be installed into whichever Python environment thepip3executable controls.This is not evidence that
tomliitself is malicious. The weakness is that dependency identity and integrity are not reproducibly enforced. A compromised upstream release, package-index account, index configuration, or network/package mirror could introduce code that executes during installation or subsequent import.Attack Path
- A user or Agent runs
scripts/setup_deps.shon Python earlier than 3.11. - Neither
tomllibnortomliis available. - The script executes
pip3 install tomli. pip3resolves the latest package accepted by the mutable lower-bound constraint from its configured index or mirror.- If the resolved dis ...[truncated 825 chars]
- A user or Agent runs
- Remediation
View remediation
Remediation Suggestions
-
Pin
tomlito a specifically reviewed version rather than using only a lower bound. -
Generate a lock or constraints file containing cryptographic hashes for every permitted distribution.
-
Install with hash enforcement, for example:
bash python3 -m pip install --require-hashes -r requirements.lock -
Use
python3 -m pipso the installer is tied to the Python interpreter that will run the application. -
Require and verify an activated project-local virtual environment before installing dependencies.
-
Document the trusted package index and prevent unintentional resolution through untrusted extra indexes or mirrors.
-
Prefer failing with clear installation instructions over silently modifying a global Python environment.
-
