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 implementation at `scripts/main.py:195-200` and documentation at `SKILL.md:130` **Vulnerability Type**: Dependency-name mismatch and unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code `requirements.txt:1`: ```text docx ``` `scripts/main.py:195-200`: ```python try: from docx import Document except ImportError: print("Error: python-docx not installed. Run: pip install python-docx") sys.exit(1) ``` The implementation and documentation identify `python-docx` as the required package, while `requirements.txt` declares the differently named `docx` package. The declared package is also not pinned to a reviewed version or protected with an integrity hash. ### Technical Analysis Python distribution names do not necessarily match import names. The correct distribution used to provide the supported `docx` import is documented by this project as `python-docx`, but the installation manifest requests `docx`. Consequently, installing the repository's requirements can retrieve an unintended or incompatible distribution. Because Python package installation may execute build or installation logic, dependency-name mistakes are a supply-chain boundary issue rather than only a reliability defect. The absence of a version constraint and integrity hash also permits future package releases to be selected without repository review. No evidence in the audited project establishes that the declared dependency is itself malicious. The vulnerability is the project's unsafe and inconsistent dependency declaration. ### Attack Path 1. A user or automated build system runs `pip install -r requirements.txt`. 2. The package resolver requests the distribution named `docx`, rather than the documented `python-docx` distribution. 3. The package and its installation/build components run with the permissions of the user or CI worker invoking `pip`. 4. An unintended, compromi ...[truncated 740 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the incorrect dependency name with the reviewed distribution: ```text python-docx==<reviewed-version> ``` 2. Pin an exact version after compatibility and vulnerability review. 3. Generate and enforce cryptographic hashes, for example with a locked requirements file and `pip install --require-hashes`. 4. Configure package installation to use an approved package index. 5. Add a clean-environment test that installs dependencies and verifies: ```python from docx import Document ``` 6. Add dependency vulnerability and provenance scanning to CI. 7. Keep the package name consistent across `requirements.txt`, `SKILL.md`, and runtime error messages. ]]>
