T08 · Insecure Dependencies
- Location
scripts/pip-safe.sh:91- Finding
Unpinned and Unvalidated Python Dependency Installation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/pip-safe.sh:91,scripts/pip-safe.sh:123-126,scripts/pip-safe.sh:148-151;SKILL.md:53,SKILL.md:63,SKILL.md:87,SKILL.md:103-104
Vulnerability Type: Supply-chain exposure through unpinned packages, unvalidated requirement files, and automatic build-tool upgrades
Risk Level: MediumVulnerable Code
The virtual-environment workflow automatically upgrades foundational packaging tools from the active pip index:
bash ensure-venv) venv_dir="${1:-}" [[ -n "$venv_dir" ]] || usage if [[ ! -d "$venv_dir" ]]; then "$python_bin" -m venv "$venv_dir" fi "$venv_dir/bin/python" -m pip install --upgrade pip setuptools wheel ;;Arbitrary package arguments are passed directly to pip, including when no virtual environment is selected:
bash if [[ -n "$venv_dir" ]]; then pip_with_venv "$python_bin" "$venv_dir" install "${extra[@]}" "$@" else pip_with_python "$python_bin" install "${extra[@]}" "$@" fiRequirement files are installed without validating package sources, hashes, or version constraints:
bash req_file="${1:-}" [[ -n "$req_file" ]] || die "missing requirements file" [[ -f "$req_file" ]] || die "requirements file not found: $req_file" if [[ -n "$venv_dir" ]]; then pip_with_venv "$python_bin" "$venv_dir" install -r "$req_file" else pip_with_python "$python_bin" install -r "$req_file" fiThe accompanying instructions also recommend unpinned installations and build-tool upgrades:
bash python3 -m pip install requests pydantic python3 -m pip install -U pip setuptools wheelTechnical Analysis
Package names, versions, download indexes, direct URLs, and requirement-file contents are not validated before being supplied to pip. The workflow does not require exact version pins, cryptographic hashes, or a trusted package index.
Installing a Python package can ...[truncated 2030 chars]
- Remediation
View remediation
Remediation Suggestions
- Require
--venvfor installation, removal, requirements, and freeze operations. If non-virtual-environment operation is necessary, require an explicit option such as--allow-non-venvand interactive confirmation. - Do not automatically upgrade
pip,setuptools, andwheelduring virtual-environment creation. Separate this into an explicit, user-approved operation with pinned versions. - Prefer exact dependency pins and hash verification, for example:
bash python -m pip install --require-hashes -r requirements.txt - Generate and review lock files through a controlled dependency-resolution process. Commit approved hashes and versions to the project.
- Restrict installation to explicitly trusted indexes and disable implicit fallback indexes where practical:
bash python -m pip install \ --index-url https://pypi.org/simple \ --require-hashes \ -r requirements.txt - Validate and reject unexpected direct URLs, editable installs, local paths, archive references, additional index directives, and other unsafe requirement-file options unless the user explicitly approves them.
- Display the resolved interpreter, pip configuration, index hosts, packages, versions, and requirement source before installation.
- Require explicit approval before installing unknown packages or dependencies that require local builds.
- Perform higher-risk package builds in an isolated container or similarly restricted environment with limited credentials, filesystem access, and network connectivity.
- Require
