T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Incorrect and Unpinned Third-Party Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1-2; related imports and documentation atscripts/main.py:20-30andSKILL.md:27-34
Vulnerability Type: Dependency-name inconsistency and unpinned dependencies
Risk Level: MediumVulnerable Code
text docx requestsThe implementation expects the
python-docxproject through the following imports:python try: from docx import Document from docx.shared import Inches, Pt, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH HAS_DOCX = True except ImportError: HAS_DOCX = False try: import requests HAS_REQUESTS = True except ImportError: HAS_REQUESTS = FalseTechnical Analysis
The dependency manifest specifies
docx, whereas the documented dependency ispython-docx. Althoughpython-docxexposes thedocximport namespace,docxandpython-docxare distinct distribution names in package repositories. Installing fromrequirements.txtcan therefore retrieve a package other than the one the implementation and documentation intend.Neither dependency has an exact version constraint or integrity hash. Consequently, subsequent installations may resolve to newly published package versions that were not reviewed with this project. This increases exposure to dependency confusion, compromised upstream releases, unexpected breaking changes, and non-reproducible builds.
The audit did not establish that either currently resolved package is malicious. The vulnerability is the uncontrolled and inconsistent dependency-resolution process.
Attack Path
- A user or automated environment installs dependencies with
pip install -r requirements.txt. - The package resolver retrieves the package named
docx, rather than the documentedpython-docxdistribution. - The resolver also selects whatever
requestsanddocxversions currently satisfy the unconstrained requireme ...[truncated 838 chars]
- A user or automated environment installs dependencies with
- Remediation
View remediation
Remediation Suggestions
- Replace the incorrect distribution name with the intended package:
text python-docx==<reviewed-version> requests==<reviewed-version> - Select versions that have been reviewed against current security advisories and compatibility requirements.
- Generate a lock file or hash-verified requirements file, for example with
pip-compile --generate-hashes. - Install with hash enforcement where practical:
bash pip install --require-hashes -r requirements.txt - Run dependency vulnerability scanning in CI and update dependencies through a controlled review process.
- Keep
SKILL.md,requirements.txt, and the actual import behavior consistent. - Install dependencies inside an unprivileged, isolated virtual environment rather than into a system-wide Python installation.
- Replace the incorrect distribution name with the intended package:
