T08 · Insecure Dependencies
Warning
- Location
- requirements.txt:1
- Finding
- Incorrect and Unpinned DOCX Dependency Creates Supply-Chain Risk<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1` **Related Locations**: `SKILL.md:32`, `SKILL.md:122`, `scripts/main.py:197-201` **Vulnerability Type**: Dependency confusion and non-reproducible dependency resolution **Risk Level**: Medium ### Vulnerable Code ```text docx ``` The implementation and documentation instead expect `python-docx`: ```python try: from docx import Document except ImportError: print("Error: python-docx not installed. Run: pip install python-docx") sys.exit(1) ``` ### Technical Analysis The dependency manifest declares the distribution named `docx`, while the documentation identifies the required distribution as `python-docx`. Although both can relate to the `docx` import namespace, they are different package identities. This mismatch can cause installation of an unintended, obsolete, or incompatible package. The dependency is also unversioned and has no integrity hash. Consequently, installations are not reproducible and automatically trust whichever package version the configured package index resolves at installation time. Python package installation and import can execute package-controlled code with the permissions of the user running the skill. ### Attack Path 1. A user or automated agent follows the project setup process and runs `pip install -r requirements.txt`. 2. The package resolver requests the distribution named `docx`, rather than the documented `python-docx` dependency. 3. The resolver downloads the package from the configured package index without a version or integrity constraint. 4. Package-controlled installation or imported module code executes in the user's environment. 5. A compromised, substituted, or incompatible release can access data and resources available to the installing user. ### Impact Assessment Successful supply-chain exploitation would execute code with the privileges of the account installing or running the skill. This could expose manuscript conten ...[truncated 310 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace `docx` with the correct reviewed distribution: ```text python-docx==<reviewed-version> ``` 2. Pin all dependencies to explicitly reviewed versions. 3. Generate a lock file containing cryptographic hashes and install with hash verification, such as: ```bash pip install --require-hashes -r requirements.lock ``` 4. Use only trusted package indexes and disable unapproved extra indexes. 5. Add a CI check that verifies the manifest, documentation, and imported package names remain consistent. 6. Run dependency vulnerability and provenance scanning before releases. ]]>
