T08 · Insecure Dependencies
- Location
- requirements.txt:1
- Finding
- Unpinned and inconsistent third-party dependency installation<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-6`; related installation commands in `install.sh:45-55` and `SKILL.md:25-33,46` **Vulnerability Type**: Supply-chain exposure through mutable dependency resolution **Risk Level**: Medium ### Vulnerable Code `requirements.txt:1-6`: ```text akshare>=1.10.0 pandas>=1.5.0 pandas-ta>=0.3.14b0 APScheduler>=3.9.0 requests>=2.28.0 pyyaml>=6.0 ``` `install.sh:45-55`: ```bash pip3 install akshare pandas APScheduler pyyaml -q 2>&1 | tee -a $LOG_FILE # 尝试安装 TA-Lib echo "" echo "5. 安装 TA-Lib..." if pip3 install TA-Lib -q 2>&1 | tee -a $LOG_FILE; then echo " ✅ TA-Lib 安装成功" else echo " ⚠️ TA-Lib 安装失败,尝试使用预编译包..." if pip3 install TA-Lib --only-binary :all: -q 2>&1 | tee -a $LOG_FILE; then ``` `SKILL.md:25-33`: ```yaml "install": [ { "id": "dependencies", "kind": "pip", "package": "akshare pandas pandas-ta APScheduler requests pyyaml", "label": "Install dependencies: pip3 install akshare pandas pandas-ta APScheduler requests pyyaml", }, ], ``` ### Technical Analysis The project installs packages without exact version pins or package hashes. The `>=` constraints allow any later release, while the direct `pip3 install` commands resolve the latest package versions available at installation time. The dependency definitions are also inconsistent. The Skill metadata requests `pandas-ta`, whereas `install.sh` installs `TA-Lib`. As a result, the effective dependency set depends on which installation method the user follows. This prevents reproducible security review and increases exposure to compromised releases, malicious maintainer updates, dependency substitution, and unexpected breaking changes. Python packages may execute code during build or installation, and imported packages execute module initialization code with the privileges of the invoking user. ### Attack Path 1. An attacker compromises a permitted dependency release, its maintainer ac ...[truncated 858 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace all lower-bound or unversioned dependencies with a single reviewed lock file containing exact versions. 2. Generate and verify cryptographic hashes for every package and transitive dependency. 3. Install with a command such as: ```bash python3 -m pip install --require-hashes -r requirements.lock ``` 4. Make `SKILL.md`, `install.sh`, and package metadata consume the same lock file rather than maintaining separate dependency lists. 5. Resolve the `pandas-ta` versus `TA-Lib` inconsistency and document the single supported indicator implementation. 6. Install dependencies inside a dedicated virtual environment under an unprivileged account. 7. Use a trusted package index explicitly and incorporate dependency vulnerability scanning into releases. ]]>
