T08 · Insecure Dependencies
Warning
- Location
- scripts/nlu.py:16
- Finding
- Unpinned Third-Party Dependencies Permit Unsafe Supply-Chain Updates## Vulnerability Details **File Location**: `scripts/nlu.py:16-22` and `scripts/nlu.py:38-40` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code ```python Requires: - google-cloud-dialogflow-cx - google-auth Install: pip install google-cloud-dialogflow-cx google-auth ``` ```python except ImportError: print("Error: google-cloud-dialogflow-cx not installed") print("Run: pip install google-cloud-dialogflow-cx google-auth") sys.exit(1) ``` ### Technical Analysis The installation instructions direct users to install mutable, unconstrained versions of `google-cloud-dialogflow-cx`, `google-auth`, and their transitive dependencies. The project does not provide version constraints, cryptographic hashes, or a dependency lockfile. Although the named packages are consistent with the declared Google Cloud functionality and no typosquatting was identified, unconstrained dependency resolution makes installations non-reproducible. A future compromised or unexpectedly incompatible release could be selected without further review. Python packages may execute code during installation or whenever imported; this script imports the dependencies immediately at lines 27-33. Exploitation therefore depends on compromise of a named package, its distribution channel, or one of its unconstrained transitive dependencies. The project itself does not contain evidence that these dependencies are currently malicious. ### Attack Path 1. An attacker compromises a future release of a named dependency, one of its transitive dependencies, or the associated package-distribution account. 2. A user follows the documented or runtime installation instruction: ```bash pip install google-cloud-dialogflow-cx google-auth ``` 3. Because no reviewed versions or hashes are enforced, `pip` resolves and installs the attacker-controlled release. 4. Malicious package code ...[truncated 756 chars]
- Remediation
- ## Remediation Suggestions 1. Create a dependency manifest with exact, reviewed versions for all direct dependencies. 2. Generate a fully resolved lockfile that also pins transitive dependencies. 3. Record cryptographic hashes and require their verification during installation, for example: ```bash python -m pip install --require-hashes -r requirements.txt ``` 4. Replace the unconstrained installation guidance in both the module documentation and error message with installation from the locked requirements file. 5. Use an isolated virtual environment rather than installing packages globally: ```bash python -m venv .venv . .venv/bin/activate python -m pip install --require-hashes -r requirements.txt ``` 6. Review and update pinned dependencies on a controlled schedule, using vulnerability and provenance checks before accepting new versions. 7. Run the CLI with a least-privileged Google Cloud identity whose IAM permissions are limited to the required Dialogflow CX resources.
