T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unbounded and Unverified Third-Party Dependencies
- Content
View full analysis
=1.2.89 pandas>=1.5.0 ``` `metadata.json:16-17`: ```json "tushare>=1.2.89", "pandas>=1.5.0" ``` `README.md:91`: ```bash pip install tushare pandas ``` ### Technical Analysis The project specifies only minimum dependency versions and places no upper bounds on accepted releases. It also provides no lockfile, package hashes, or integrity-verification procedure. The documented installation command resolves whichever package versions are current at installation time. As a result, the installed code may differ from the dependency versions present when the skill was audited. Python packages can execute code during installation and when imported. This project imports both dependencies at process startup, including `tushare` through the following logic in `__init__.py`: ```python import pandas as pd try: import tushare as ts TUSHARE_AVAILABLE = True except ImportError: TUSHARE_AVAILABLE = False ``` This finding does not establish that the current `tushare` or `pandas` releases are malicious. The vulnerability is the absence of reproducible and integrity-verified dependency resolution, which creates an exploitable supply-chain path if an accepted future release or package distribution channel is compromised. ### Attack Path 1. An attacker compromises an upstream dependency publisher account, package release process, or package distribution channel. 2. The attacker publishes a malicious version of `tushare` or `pandas` that still satisfies the open-ended version requirement. 3. A user or deployment platform installs the project using `requirements.txt`, the metadata dependency declarations, or the documented `pip install tushare pandas` command. 4. The package re ...[truncated 1105 chars]- Remediation
View remediation
pandas== ``` 2. Generate a hash-locked dependency file using a controlled tool such as `pip-compile --generate-hashes`, and install it with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.lock ``` 3. Keep `metadata.json` consistent with the reviewed dependency versions rather than using unrestricted minimum versions. 4. Change the README installation instructions to use the project's locked dependency file instead of installing the latest available packages: ```bash python -m pip install --require-hashes -r requirements.lock ``` 5. Configure package installation to use an approved package index or internal mirror, and prohibit fallback to untrusted indexes. 6. Perform automated dependency vulnerability and provenance checks in CI. Review, test, and regenerate hashes explicitly before accepting dependency upgrades. 7. Run the skill in a least-privilege environment with restricted filesystem and network access. Provide `TUSHARE_TOKEN` only at runtime and avoid exposing unrelated secrets to the process. ]]>
