T08 · Insecure Dependencies
- Location
scripts/setup.sh:47- Finding
Unpinned Third-Party Dependencies Create a Supply-Chain Risk
- Content
View full analysis
Vulnerability Details
File Location:
scripts/setup.sh, lines 47–66
Vulnerability Type: Unpinned and unverified third-party dependency installation
Risk Level: MediumVulnerable Code
bash # ── Upgrade pip silently ────────────────────────────────────────────────────── info "Upgrading pip..." "$PYTHON" -m pip install --quiet --upgrade pip ok "pip up to date" # ── Core ragas packages ─────────────────────────────────────────────────────── info "Installing ragas + datasets..." "$PYTHON" -m pip install --quiet "ragas>=0.2.0" "datasets>=2.0" ok "ragas + datasets" # ── LangChain integrations (required for LLM-as-judge) ─────────────────────── info "Installing LangChain core + integrations..." "$PYTHON" -m pip install --quiet \ "langchain-core>=0.3" \ "langchain-community>=0.3" \ "langchain-openai>=0.2" \ "langchain-anthropic>=0.2" ok "langchain-core, langchain-community, langchain-openai, langchain-anthropic" # ── Optional: HuggingFace offline embeddings ───────────────────────────────── info "Installing optional offline embeddings (HuggingFace)..." if "$PYTHON" -m pip install --quiet langchain-huggingface sentence-transformers 2>/dev/null; thenTechnical Analysis
The setup process resolves and installs mutable package versions from pip without exact version pins, integrity hashes, a committed lockfile, or an explicitly enforced trusted package index. Constraints such as
ragas>=0.2.0permit any later release, while several optional packages have no version constraint at all. The script also dynamically upgrades pip.Consequently, the code reviewed in this project does not fully determine the code that users execute. A compromised future release, compromised dependency account, malicious transitive dependency, or attacker-controlled package index configured in the user's pip environment could introduce arbitrary code into the virtual environment.
This is a supply-chain weakness rather than evidence that any cur ...[truncated 1719 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace broad constraints with exact, reviewed versions for direct dependencies.
- Generate and commit a reproducible lockfile containing all transitive dependencies.
- Include SHA-256 hashes and install with
pip --require-hashes. - Install from a dedicated requirements file rather than resolving packages independently in multiple commands.
- Explicitly enforce the intended HTTPS package index and disable unintended supplemental indexes where operationally appropriate.
- Avoid automatically upgrading pip during routine setup; pin and review the installer version separately.
- Use an automated dependency-update process that runs security scanning and tests before lockfile changes are merged.
- Consider the following installation pattern:
bash "$PYTHON" -m pip install \ --require-hashes \ --only-binary=:all: \ -r requirements.lock- Continue requiring an activated virtual environment, as the existing check usefully reduces the scope of package modifications.
