T08 · Insecure Dependencies
- Location
scripts/setup_engine.py:19- Finding
Unpinned Dependencies Installed from Mutable Package Sources
- Content
View full analysis
Vulnerability Details
File Location:
scripts/setup_engine.py:19-25;scripts/engine/requirements.txt:1-6
Vulnerability Type: Unpinned third-party dependencies and non-reproducible installation
Risk Level: MediumVulnerable Code
python def main() -> int: if not REQUIREMENTS.exists(): raise FileNotFoundError(f'Requirements file not found: {REQUIREMENTS}') if not VENV_DIR.exists(): run([sys.executable, '-m', 'venv', str(VENV_DIR)]) python_bin = VENV_DIR / 'bin/python' run([str(python_bin), '-m', 'pip', 'install', '--upgrade', 'pip']) run([str(python_bin), '-m', 'pip', 'install', '-r', str(REQUIREMENTS)])The requirements file contains no version or integrity constraints:
text python-docx docxtpl openpyxl XlsxWriter python-pptx pydanticTechnical Analysis
The setup process upgrades
pipand installs all dependencies using mutable package names without exact versions or cryptographic hashes. Consequently, two installations performed at different times can resolve to different package or transitive-dependency versions.The project does not contain evidence that the currently named packages are malicious. The vulnerability is the absence of controls ensuring that reviewed dependency artifacts are the artifacts installed later. If a package account, release, dependency, configured package index, or distribution artifact is compromised, the setup process can install attacker-controlled code.
Python packages may execute build backend logic while being built or installed. Installed malicious code could also execute when the document generator imports the affected package.
Attack Path
- An attacker compromises a declared package, one of its transitive dependencies, or a package index trusted by the executing environment.
- The attacker publishes a malicious release that satisfies the unconstrained dependency declaration.
...[truncated 1081 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin every direct dependency to an exact, reviewed version.
- Generate a lock file that includes resolved transitive dependencies.
- Record SHA-256 hashes for every permitted distribution and install with
pip --require-hashes. - Use a controlled package index or an internal artifact mirror containing reviewed packages.
- Remove the unconditional
pipupgrade, or pinpipto a reviewed version and hash. - Run installation in a restricted environment without unnecessary credentials or filesystem access.
- Add automated dependency vulnerability and provenance scanning to release workflows.
- Regularly update pins through a review process rather than allowing installation-time resolution.
