T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unnecessary Unpinned Standard-Library Backport Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1-2
Vulnerability Type: Unnecessary and unpinned third-party dependencies
Risk Level: MediumVulnerable Code
text dataclasses enumThe project documentation states that Python 3.7 or later is required and that no external packages are needed:
bash # Python 3.7+ # No external packages required (uses standard library)Technical Analysis
Both
dataclassesandenumare part of the Python standard library in the project's stated Python 3.7+ environment. The implementation imports these standard-library modules and does not require separately installed packages with these names.Nevertheless, a conventional installation command such as
pip install -r requirements.txtinstructspipto retrieve unpinned third-party distributions. No exact versions, package hashes, or trusted package index are specified. This creates an unnecessary supply-chain execution path and contradicts the documented dependency model.Python packages may execute build or installation logic during installation. Consequently, compromise of an upstream distribution, unsafe package resolution, or use of an untrusted package index could result in arbitrary code execution under the account running
pip.Attack Path
-
A user or automated deployment pipeline runs:
bash pip install -r requirements.txt -
pipresolves the unpinneddataclassesandenumpackage names through its configured package indexes. -
Third-party package artifacts are downloaded even though the runtime already provides the required modules.
-
Package build or installation code executes with the privileges of the user or service performing installation.
-
If a resolved distribution or configured index is compromised, malicious installation code could read accessible data, modify the environment, install persistence, or tamper with project files.
Exploitation depends on compromise or manipulation ...[truncated 747 chars]
-
- Remediation
View remediation
Remediation Suggestions
-
Remove both entries from
requirements.txt, because Python 3.7+ already suppliesdataclassesandenum. -
Delete
requirements.txtor leave it empty if the project has no external runtime dependencies. -
Keep the documented minimum Python version aligned with the implementation and dependency manifest.
-
If support for an older Python version is intentionally introduced, use explicitly audited backports with exact version pins and cryptographic hashes.
-
Install dependencies only from an approved index and use hash-enforced installation where third-party packages are genuinely necessary, for example:
bash pip install --require-hashes -r requirements.txt -
Add an automated dependency-manifest check to prevent standard-library modules or unpinned packages from being added inadvertently.
-
