T08 · Insecure Dependencies
- Location
scripts/split_sentences.py:18- Finding
Unpinned Third-Party Dependency Installation Guidance in Sentence-Splitting Script
- Content
View full analysis
Vulnerability Details
File Location:
scripts/split_sentences.py:18-22
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: LowVulnerable 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-docxfrom 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
- A user runs
split_sentences.pyin an environment wherepython-docxis unavailable. - The import fails, and the script recommends running
pip install python-docx. - The user executes the command against the default package index.
- Pip resolves the latest compatible package and its dependencies without checking project-supplied hashes.
- If the selected package artifact or dependency chain has been compromised, attacker-controlled installation or import-time code executes.
- 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]
- A user runs
- Remediation
View remediation
Remediation Suggestions
- Add an audited, pinned
python-docxversion 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.
- Add an audited, pinned
