T08 · Insecure Dependencies
Note
- Location
- scripts/split_sentences.py:18
- Finding
- Unpinned Third-Party Dependency Installation Guidance in Sentence-Splitting Script## Vulnerability Details **File Location**: `scripts/split_sentences.py:18-22` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Low ### Vulnerable Code ```python try: from docx import Document except ImportError: print("Error: the python-docx library is required") print("Run: pip install python-docx") sys.exit(1) ``` ### Technical Analysis The script directs users to install `python-docx` from the default Python package index without specifying an audited version, validating artifact hashes, using a lock file, or constraining the package source. Because the package version and resolved transitive dependencies are mutable, the code ultimately imported by the script may differ between installations. This exposes users to supply-chain risks if the package publisher account, package repository, release artifact, or transitive dependency is compromised. The script does not automatically execute the installation command, so exploitation requires the user to follow the displayed guidance. No evidence of an intentionally malicious package or dependency-confusion namespace was identified. ### Attack Path 1. A user runs `split_sentences.py` in an environment where `python-docx` is unavailable. 2. The import fails, and the script recommends running `pip install python-docx`. 3. The user executes the command against the default package index. 4. Pip resolves the latest compatible package and its dependencies without checking project-supplied hashes. 5. If the selected package artifact or dependency chain has been compromised, attacker-controlled installation or import-time code executes. 6. The malicious code runs with the permissions of the user performing the installation or running the script. ### Impact Assessment A compromised dependency could read or modify files accessible to the current user, access documents processed by the Skill, use available network c ...[truncated 225 chars]
- Remediation
- ## Remediation Suggestions - Add an audited, pinned `python-docx` version to a dependency file. - Generate and verify cryptographic hashes for the package and all transitive dependencies. - Use a command such as `pip install --require-hashes -r requirements.txt`. - Maintain a lock file and review dependency updates before adoption. - Configure installations to use an approved package index. - Run document-processing scripts in a virtual environment with only the filesystem and network permissions required for the task. - Add automated dependency vulnerability and integrity scanning to the release process.
