T08 · Insecure Dependencies
- Location
scripts/install_dependencies.sh:6- Finding
Unpinned Third-Party Dependencies Installed into the Active Python Environment
- Content
View full analysis
Vulnerability Details
File Location:
scripts/install_dependencies.sh, lines 6-9
Vulnerability Type: Unpinned and integrity-unverified dependency installation
Risk Level: MediumVulnerable Code
bash pip install --upgrade pip # Core dependencies pip install python-docx PyPDF2 pdfplumberTechnical Analysis
The installation script upgrades
pipand installs three third-party packages without fixed versions, package hashes, a lock file, or an explicitly trusted package index. Consequently, each installation can resolve to different artifacts. The command also uses whicheverpipexecutable appears first inPATHand does not establish an isolated virtual environment.Python package installation can execute package build or installation logic with the privileges of the user running the script. If the configured package index, dependency-resolution path, or a future package release is compromised, attacker-controlled code could execute during installation. Upgrading
pipis unnecessary for the document-parsing functionality and expands the mutable supply-chain surface.The project documentation directs users to run this script during first-use setup, making this behavior part of the expected deployment workflow.
Attack Path
- A user follows the documented setup procedure and runs
bash scripts/install_dependencies.sh. - The shell resolves
pipfrom the user's currentPATHand uses the environment's configured package index. pipis upgraded to the latest available version, after which mutable latest versions ofpython-docx,PyPDF2, andpdfplumber, including transitive dependencies, are resolved.- If an index, resolved artifact, dependency, or future release has been compromised, attacker-controlled installation or build code executes.
- That code runs with the privileges of the invoking user and can access resources available to that account.
Impact Assessment
Successful exploitation could permi ...[truncated 554 chars]
- A user follows the documented setup procedure and runs
- Remediation
View remediation
Remediation Suggestions
- Remove the unnecessary
pipself-upgrade from the installation script. - Create and use a dedicated virtual environment so packages do not modify the active global environment.
- Invoke pip through the intended interpreter, such as
python3 -m pip, rather than relying onPATHresolution. - Pin all direct and transitive dependencies to reviewed versions in a lock or requirements file.
- Record cryptographic hashes and install with
--require-hashes. - Use an explicitly configured trusted package index and reject unexpected fallback indexes.
- Add dependency scanning and controlled update review to the release process.
Example hardened workflow:
bash #!/usr/bin/env bash set -euo pipefail python3 -m venv .venv .venv/bin/python -m pip install \ --require-hashes \ --only-binary=:all: \ -r requirements.lockThe referenced
requirements.lockshould pin every resolved package and include verified SHA-256 hashes for all permitted artifacts.- Remove the unnecessary
