T08 · Insecure Dependencies
- Location
references/worktrees.md:62- Finding
Automatic Execution of Unreviewed Repository Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
references/worktrees.md:62-66
Vulnerability Type:T08: Insecure Dependencies
Risk Level: HighVulnerable Code:
bash [ -f package.json ] && npm install [ -f Cargo.toml ] && cargo build [ -f requirements.txt ] && pip install -r requirements.txt [ -f pyproject.toml ] && poetry install [ -f go.mod ] && go mod downloadTechnical Analysis
The worktree setup instructions automatically select and execute package-management or build commands based solely on the presence of repository-controlled manifest files. They do not require prior inspection of dependency declarations, lockfiles, package sources, lifecycle scripts, or build hooks.
Several listed commands can execute third-party or repository-controlled code:
npm installcan execute dependency and project lifecycle scripts.cargo buildcan execute Rust build scripts such asbuild.rs.- Python dependency installation can invoke package build backends and installation hooks.
- Other package managers can retrieve dependencies from external registries and process repository-controlled configuration.
The guidance does not require explicit user approval before these operations, immutable lockfile modes, trusted-source validation, disabled installation scripts, restricted network access, or sandboxing. Consequently, merely opening an untrusted repository and requesting worktree setup can cross from static repository inspection into local code execution.
Attack Path
- An attacker creates or compromises a repository containing a recognized manifest such as
package.json,Cargo.toml,requirements.txt, orpyproject.toml. - The attacker adds a malicious dependency, lifecycle script, build script, or package build hook.
- A user asks the Skill to create an isolated worktree for that repository.
- The Skill detects the manifest and automatically runs the corresponding installation ...[truncated 1151 chars]
- Remediation
View remediation
Remediation Suggestions
- Require explicit user approval before installing dependencies or invoking any build system, especially for repositories that have not been reviewed.
- Inspect manifests, lockfiles, package-manager configuration, lifecycle scripts, Rust build scripts, and Python build backends before execution.
- Enforce immutable, lockfile-based installation where available, such as
npm cirather than unconstrainednpm install. - Disable installation scripts when they are not required, for example with
npm ci --ignore-scripts, and only enable them after review. - Restrict package sources to approved registries and validate dependency names and resolved origins to reduce dependency-confusion and typosquatting risk.
- Run dependency installation and builds in a sandbox or disposable container with minimal filesystem access, no sensitive credentials, and restricted outbound networking.
- Separate dependency download from code execution where supported, and report the planned commands and security implications before running them.
- Pin dependency versions and verify lockfile integrity or package checksums when the ecosystem supports it.
