T08 · Insecure Dependencies
Warning
- Location
- scripts/bsky:12
- Finding
- Automatic Installation of Unhashed and Loosely Pinned Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bsky:12-15`; `requirements.txt:1` **Vulnerability Type**: Supply-chain exposure through automatic dependency installation **Risk Level**: Medium ### Vulnerable Code `scripts/bsky:12-15`: ```bash # Create venv if needed if [ ! -d "$VENV_DIR" ]; then echo "Setting up Bluesky CLI..." >&2 python3 -m venv "$VENV_DIR" "$VENV_DIR/bin/pip" install -q -r "$SCRIPT_DIR/../requirements.txt" fi ``` `requirements.txt:1`: ```text atproto>=0.0.65,<0.1.0 ``` ### Technical Analysis On its first invocation, the launcher automatically creates a virtual environment and retrieves packages from the Python package index configured for `pip`. The dependency is specified as a version range rather than an exact version, and no cryptographic hashes or lockfile are supplied. Consequently, the code executed by the Skill is not limited to the source reviewed in this project. Any future `atproto` release matching the range, as well as its resolved transitive dependencies, may be downloaded and executed without repository-level review. The effective package source can also be influenced by the user's or environment's `pip` configuration. The audit found no evidence that the current dependency is malicious. The vulnerability is the absence of controls that ensure the installed artifact is the exact dependency set reviewed and approved by the Skill publisher. ### Attack Path 1. An attacker compromises an allowed release of the direct dependency, one of its transitive dependencies, or a package index trusted by the local `pip` configuration. 2. The user invokes `scripts/bsky` on a system where `scripts/venv` does not yet exist. 3. The wrapper silently creates the virtual environment and executes `pip install` using the broad dependency constraint. 4. `pip` resolves and installs the attacker-controlled or compromised package without checking repository-supplied hashes. 5. The package executes with the privileges ...[truncated 916 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the direct dependency to an exact reviewed version instead of permitting a broad range. 2. Generate a lockfile containing exact versions for all direct and transitive dependencies. 3. Record and enforce cryptographic hashes for every downloaded artifact, for example by using: ```bash pip install --require-hashes -r requirements.lock ``` 4. Configure an explicit trusted package index rather than inheriting an arbitrary environment-specific index configuration. 5. Perform dependency installation as a separate, visible setup step instead of automatically downloading code during an ordinary CLI invocation. 6. Run dependency vulnerability and provenance checks in CI before publishing each release. 7. Consider distributing a reproducibly built package or verified environment whose dependency artifacts are fixed at release time. ]]>
