T08 · Insecure Dependencies
- Location
- sync.js:31
- Finding
- Unpinned Runtime Package Retrieval and Execution<![CDATA[ ## Vulnerability Details **File Location**: `sync.js:31-45`; related dependency declarations in `SKILL.md:13-20` and `package.json:10-14` **Vulnerability Type**: Remote execution of mutable, unpinned third-party dependencies **Risk Level**: Medium ### Vulnerable Code ```javascript const cmd = `SSL_CERT_FILE=/workspace/cacert.pem npx @googleworkspace/cli drive files list --params '{"q": "${escapedQuery}", "fields": "files(id, name, mimeType, shortcutDetails)"}'`; ``` ```javascript const cmd = `SSL_CERT_FILE=/workspace/cacert.pem npx @googleworkspace/cli drive files get --params '{"fileId": "${fileId}", "alt": "media"}' --output "${dest}"`; ``` The installation metadata also specifies the package without an exact version: ```yaml install: - id: gws kind: node package: "@googleworkspace/cli" bins: ["gws"] label: "Install Google Workspace CLI" ``` The npm dependencies use mutable caret ranges, and no lockfile was present: ```json "dependencies": { "@google/generative-ai": "^0.2.1", "chromadb": "^1.8.1", "pdf-parse": "^1.1.1", "dotenv": "^16.4.5" } ``` ### Technical Analysis The synchronization process executes `npx @googleworkspace/cli` without specifying an exact reviewed version or requiring a previously installed local binary. Depending on the local npm configuration and package availability, `npx` can retrieve and execute the current registry version at runtime. This creates a mutable code-execution channel: the code that executes during synchronization may differ from the code reviewed with this Skill. The risk is increased by the absence of a package lockfile and the use of mutable dependency ranges. This behavior is unnecessary at runtime because the declared setup process can install a reviewed, pinned CLI version before the Skill is invoked. This is primarily an insecure dependency and supply-chain issue. It also has characteristics of remote payload retrieval because executable package contents can be obtained ...[truncated 1283 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add `@googleworkspace/cli` as an exact-version project dependency instead of resolving it dynamically: ```json { "dependencies": { "@googleworkspace/cli": "REVIEWED_EXACT_VERSION" } } ``` 2. Generate and commit a package lockfile containing integrity hashes. 3. Install dependencies during a controlled setup phase using `npm ci`. 4. Invoke the reviewed local executable directly, such as: ```bash ./node_modules/.bin/gws ``` 5. If `npx` must be retained, use `npx --no-install` so it fails rather than downloading code at runtime. 6. Replace all caret ranges with exact reviewed versions and use automated dependency review before upgrades. 7. Restrict package installation to a trusted registry and consider npm provenance/signature verification. 8. Run synchronization in a sandbox with only the Drive, filesystem, environment, and network access strictly required for the operation. ]]>
