T08 · Insecure Dependencies
Warning
- Location
- graphify_wrapper.py:13
- Finding
- Unpinned Automatic Installation and Execution of a Third-Party Package## Vulnerability Details **File Location**: `graphify_wrapper.py`, lines 13 and 18–39 **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```python GRAPHIFY_PKG = "graphifyy" def _run(cmd, **kwargs): """Run a command, return CompletedProcess.""" return subprocess.run(cmd, capture_output=True, text=True, timeout=kwargs.pop("timeout", 120), **kwargs) def ensure_installed(): """Ensure graphify is installed, install if missing. Returns python path.""" # Try importing graphify r = _run([sys.executable, "-c", "import graphify"]) if r.returncode == 0: return sys.executable # Install print(f"Installing {GRAPHIFY_PKG}...") r = _run([sys.executable, "-m", "pip", "install", "-q", GRAPHIFY_PKG], timeout=120) if r.returncode != 0: print(f"Install failed: {r.stderr}") sys.exit(1) # Verify r = _run([sys.executable, "-c", "import graphify"]) if r.returncode != 0: print("Install succeeded but import failed") sys.exit(1) return sys.executable ``` The automatic installation is also presented as expected usage in `SKILL.md`, lines 20–24 and 96–98: ```markdown ### Step 1 — Ensure graphify is installed ```bash python graphify_wrapper.py ensure-installed ``` ## Dependencies - Python 3.10+ - `graphifyy` (pip) — automatically installed by wrapper ``` ### Technical Analysis The wrapper installs `graphifyy` from the process's active pip index without an exact version constraint, cryptographic hash verification, or a dependency lock file. Consequently, the effective dependency code can change after the Skill itself has been audited. The risk also depends on the environment's pip configuration. A compromised package release, compromised package index, or attacker-controlled alternate index could cause pip to retrieve and install unauthorized code. After installation, the wrapper imports and executes the dependency throu ...[truncated 1707 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `graphifyy` to a specifically reviewed version rather than installing an unconstrained latest release: ```python GRAPHIFY_PKG = "graphifyy==<reviewed-version>" ``` 2. Maintain a locked requirements file containing hashes and install it with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.lock ``` 3. Pin and hash all transitive dependencies, not only the direct package. 4. Explicitly use a trusted package index and prevent unintended fallback to additional indexes. Review environment-level pip configuration before installation. 5. Avoid automatic dependency installation during normal Skill execution. Instead, fail safely with clear, separately documented installation instructions that require explicit user approval. 6. Install the dependency in a dedicated virtual environment or other sandbox rather than modifying the Agent's active Python environment. 7. Execute graph processing with least privilege and restrict its filesystem, credential, and network access where the runtime supports sandboxing. 8. Verify the pinned release's provenance and integrity before updating the lock file. Re-audit package updates before deployment.
