T08 · Insecure Dependencies
- Location
Script/parse.py:116- Finding
Unpinned Third-Party Test Dependency Installation
- Content
View full analysis
Vulnerability Details
File Location:
Script/parse.py, line 116
Vulnerability Type: Unpinned and unverified third-party dependency installation
Risk Level: LowVulnerable Code:
bash pip install pytest pytest test_parse.py -vTechnical Analysis
The test documentation instructs users to install
pytestwithout specifying an audited version or verifying package hashes. Consequently, the installed package is determined dynamically by the configured Python package index and dependency resolver at installation time.Although
pytestis a legitimate package, this installation procedure lacks reproducibility and supply-chain integrity controls. If the configured index is compromised, replaced, or incorrectly configured, a substituted distribution or malicious transitive dependency could be installed. Python packages may execute build backend or installation-related code during package installation.Attack Path
- An attacker compromises a configured Python package repository, influences the package-resolution path, or causes the user to use an untrusted package index.
- The attacker serves a malicious or modified distribution matching the requested unpinned package or one of its dependencies.
- A user follows the documented setup command:
bash pip install pytest pipresolves and downloads the attacker-controlled distribution because no version, source, or cryptographic hash is enforced.- Malicious build or installation code executes with the privileges of the user running
pip. - The installed package may execute additional malicious behavior when the documented test command is subsequently run.
Impact Assessment
Successful exploitation could execute arbitrary code with the privileges of the account performing the installation. The affected scope may include the active virtual environment, project files writable by that user, accessible credentials a ...[truncated 335 chars]
- Remediation
View remediation
Remediation Suggestions
- Move development dependencies into a dedicated lock or requirements file rather than installing them through an unpinned documentation command.
- Pin
pytestand all transitive dependencies to reviewed versions. - Generate and enforce cryptographic hashes, for example:
bash python -m pip install --require-hashes -r requirements-dev.txt - Generate the locked dependency set using a reproducible dependency-management tool and review changes before updating it.
- Explicitly use a trusted package index and prevent unexpected fallback to additional indexes.
- Install test dependencies in an isolated virtual environment with no unnecessary credentials or elevated privileges.
- Add automated dependency vulnerability and integrity checks to the project's maintenance workflow.
