T08 · Insecure Dependencies
Warning
- Location
- scripts/double6_ppt_cli/bootstrap.py:44
- Finding
- Network-Fetched npm Dependency Executes Unverified Lifecycle Scripts<![CDATA[ ## Vulnerability Details **File Location**: `scripts/double6_ppt_cli/bootstrap.py:44-50` **Vulnerability Type**: Supply-chain integrity weakness and lifecycle-script execution **Risk Level**: Medium ### Vulnerable Code ```python proc = subprocess.run( [npm, "install", "--ignore-scripts=false", "--save-exact", f"@officecli/officecli@{OFFICECLI_PIN_VERSION}"], cwd=node_dir, capture_output=True, text=True, timeout=900, ) ``` ### Technical Analysis The bootstrap operation installs `@officecli/officecli` from an npm registry and explicitly enables npm lifecycle scripts through `--ignore-scripts=false`. Although the dependency is pinned to version `1.0.144`, a version pin does not independently authenticate the downloaded tarball or its transitive dependencies. `UPSTREAM_LOCK.json` records the expected package identity, source repository, release tag, and commit, but the reviewed data does not include an npm tarball integrity value or a complete integrity-locked transitive dependency graph. The bootstrap code also does not verify downloaded package bytes against a committed digest before lifecycle scripts are allowed to execute. This is not evidence that the currently published OfficeCLI package is malicious. It is a supply-chain control gap: if the registry artifact, publisher account, registry resolution path, or a transitive dependency were compromised, installation-time code could run before the Skill verifies its provenance. The explicit user authorization requirement in `bootstrap.py:18-19` reduces unexpected installation risk, and the exact version pin reduces exposure to arbitrary future releases. Neither control, however, provides content integrity for the artifact that npm ultimately executes. ### Attack Path 1. An attacker compromises the npm publisher account, registry artifact, dependency-resolution infrastructure, or an applicable transitive dependency. 2. Malicious installation logic is introduced into the packag ...[truncated 1188 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Commit an npm lockfile containing exact package versions, resolved registry URLs, and integrity hashes for the complete dependency graph. 2. Use `npm ci` rather than `npm install` so installation fails when the lockfile and declared dependencies differ. 3. Install dependencies with lifecycle scripts disabled by default: ```bash npm ci --ignore-scripts ``` 4. If OfficeCLI requires an installation script, identify and review that script explicitly, then invoke only the minimum required setup operation after integrity verification. 5. Record the expected npm tarball SHA-256 or Subresource Integrity value in the project lock metadata and verify the downloaded artifact before extraction or execution. 6. Configure npm to use an explicitly approved registry and reject unexpected package sources. 7. Run bootstrap in a restricted environment with minimal filesystem permissions, a sanitized environment, and network access limited to approved package endpoints. 8. Ensure the referenced Python dependency lock is included in the distributed package and contains fully pinned dependencies with cryptographic hashes. ]]>
