T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unnecessary and Unpinned Third-Party Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt, lines 1–2
Vulnerability Type: Dependency confusion and unpinned supply-chain exposure
Risk Level: MediumComplete Code Snippet:
text dataclasses enumTechnical Analysis
The project declares unpinned PyPI dependencies named
dataclassesandenum. In the Python versions suitable for this project, both names correspond to modules already provided by the Python standard library and imported byscripts/main.py. Therefore, downloading identically named external packages is unnecessary.Because neither dependency is pinned to an exact, verified artifact, installation behavior can change without any modification to this repository. Installing the requirements may retrieve mutable third-party distributions and invoke their package installation or build logic. The generic
enumpackage also risks shadowing or conflicting with Python's standard-libraryenummodule.This creates avoidable package-repository and dependency-confusion exposure. The audit found no evidence that the currently named packages are malicious; the vulnerability is the unnecessary trust boundary and lack of version or artifact integrity controls.
Attack Path
- A user or automated build process runs
pip install -r requirements.txt. - The package resolver queries its configured public or private package index for distributions named
dataclassesandenum. - An attacker compromises a referenced distribution, publishes a malicious version through an index-resolution weakness, or influences a private index to resolve an attacker-controlled artifact.
- The resolver downloads the unverified package because no exact version or hash is specified.
- Malicious installation/build logic executes with the privileges of the user or CI process running
pip, or malicious package code is later imported through module shadowing.
Impact Assessment
Successful e ...[truncated 559 chars]
- A user or automated build process runs
- Remediation
View remediation
Remediation Suggestions
-
Remove both dependencies because
dataclassesandenumare available from the Python standard library on supported Python versions. -
Declare and enforce a minimum supported Python version instead of installing standard-library substitutes.
-
If legacy Python support genuinely requires a
dataclassesbackport, use an explicit environment marker, an exact reviewed version, and a cryptographic hash. For example:text dataclasses==<reviewed-version> ; python_version < "3.7" \ --hash=sha256:<verified-artifact-hash> -
Do not install the external
enumdistribution; use the standard-libraryenummodule. -
Configure CI to install dependencies with hash verification, such as
pip install --require-hashes -r requirements.txt. -
Use an approved package index or repository proxy and periodically scan locked dependency artifacts for known compromise or vulnerabilities.
-
