T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:15
- Finding
- Mutable Third-Party Dependency Installation## Vulnerability Details **File Location**: `SKILL.md:15-16` **Vulnerability Type**: Unpinned third-party dependencies and unconditional package upgrades **Risk Level**: Medium ### Vulnerable Code ```bash pip install baostock --upgrade ``` Related mutable dependency declarations also appear in: - `README.md:18-19` - `demo_project/README.md:7-9` - `requirements.txt:1-2` - `metadata.json:17-21` ```text baostock>=0.8.0 pandas>=1.5.0 ``` ```json "dependencies": { "python": ">=3.8", "packages": [ "baostock>=0.8.0", "pandas>=1.5.0" ] } ``` ### Technical Analysis The installation instructions use `--upgrade`, while the dependency manifests specify only minimum versions. Consequently, installation can resolve to future package releases that were not reviewed during this audit. The project provides no exact version pins, lockfile, package hashes, or other integrity verification. The package names are consistent throughout the project, and the audited files contain no evidence of typosquatting, dependency confusion, or a currently malicious dependency. The risk arises from mutable dependency resolution: if a qualifying future release or its distribution channel is compromised, users following the documented installation process could install attacker-controlled code. Python packages may execute code during installation, and their modules execute code when imported. Both `baostock` and `pandas` are imported by the supplied examples, including `demo_project/demo.py:1-2`. ### Attack Path 1. An attacker compromises a dependency publisher account, package build pipeline, or distribution channel. 2. The attacker publishes a malicious release newer than the locally installed version and compatible with the lower-bound constraints. 3. A user runs the documented `pip install baostock --upgrade` command or installs from `requirements.txt`. 4. Pip resolves and installs the malicious qualifying release because no exact version or integrity hash prevents it. ...[truncated 877 chars]
- Remediation
- ## Remediation Suggestions 1. Replace lower-bound-only constraints with exact versions that have been reviewed and tested: ```text baostock==REVIEWED_VERSION pandas==REVIEWED_VERSION ``` 2. Remove unconditional `--upgrade` from user-facing installation instructions. Install from a controlled requirements file instead: ```bash python3 -m pip install --require-hashes -r requirements.lock ``` 3. Generate a lockfile containing exact transitive dependency versions and SHA-256 hashes. Commit it to the project and update it only through a reviewed dependency-upgrade process. 4. Verify package provenance and retrieve dependencies exclusively from an approved package index over TLS. In CI, explicitly configure the trusted index rather than inheriting arbitrary user-level pip configuration. 5. Add automated dependency scanning and release review. Test upgrades in an isolated environment before updating the lockfile. 6. Run installation and demonstrations in a virtual environment or restricted container under a non-privileged account. Avoid installing these packages globally or with administrator privileges. 7. Keep dependency declarations synchronized across `requirements.txt`, `metadata.json`, `README.md`, `SKILL.md`, and the demo documentation so that all installation paths enforce the same reviewed versions.
