T08 · Insecure Dependencies
Warning
- Location
- README.md:60
- Finding
- Unpinned Third-Party Runtime Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `README.md:60-64`, `scripts/check_openai.py:1`, `scripts/check_openrouter.py:1`, `scripts/check_vercel.py:1` **Vulnerability Type**: Supply-chain exposure through unpinned Python dependencies **Risk Level**: Medium ### Vulnerable Code ```markdown Optional: install `requests` for API auto-checks: ```bash pip install requests ``` ``` The runtime scripts also direct users to install packages without version or integrity constraints: ```python try: from openai import OpenAI except ImportError: print("❌ OpenAI library not installed. Install with: pip install openai") sys.exit(1) ``` ```python try: import requests except ImportError: print("❌ requests library not installed. Install with: pip install requests") sys.exit(1) ``` ### Technical Analysis The project does not provide a pinned `requirements.txt`, lockfile, package hashes, or an explicitly trusted package index. Users are instructed to install the latest available versions of `requests` and `openai`. This does not prove that either named package is malicious. However, it means the reviewed source does not fully determine the code that executes at runtime. A future compromised, malicious, or behaviorally incompatible dependency release could run inside the same Python process and access the process environment, filesystem permissions, and network privileges. This exposure is especially relevant because the scripts execute while provider credentials such as `OPENAI_API_KEY`, `OPENROUTER_API_KEY`, and `VERCEL_AI_GATEWAY_KEY` may be present in environment variables. ### Attack Path 1. A user enables an automatic balance checker. 2. The user follows the documentation or runtime message and executes `pip install requests` or `pip install openai`. 3. Package resolution selects the latest release because no version or hash is specified. 4. If the selected package or one of its transitive dependencies has been compromised, its ini ...[truncated 975 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add a reviewed dependency manifest with exact versions, for example: ```text openai==<reviewed-version> requests==<reviewed-version> ``` 2. Generate and verify cryptographic hashes, using a workflow such as: ```bash pip-compile --generate-hashes requirements.in pip install --require-hashes -r requirements.txt ``` 3. Pin transitive dependencies through a lockfile rather than pinning only direct dependencies. 4. Use an explicitly trusted package index and disable unexpected fallback indexes where practical: ```bash python3 -m pip install \ --index-url https://pypi.org/simple \ --require-hashes \ -r requirements.txt ``` 5. Run dependency vulnerability and provenance checks during releases. 6. Test and review dependency upgrades before updating the lockfile. 7. Execute automatic checks in a restricted environment containing only the single credential required for that provider. ]]>
