T08 · Insecure Dependencies
Warning
- Location
- scripts/playwright_utils.py:20
- Finding
- Unintended npm Package Execution Through an Incorrect Playwright CLI Fallback## Vulnerability Details **File Location**: `scripts/playwright_utils.py`, lines 20–27 **Vulnerability Type**: Dependency substitution caused by inconsistent package names **Risk Level**: Medium **Vulnerable code:** ```python def build_pw_command() -> list[str]: pw = resolve_command("playwright-cli") if pw: return [pw] npx = resolve_command("npx") if npx: return [npx, "playwright-cli"] raise RuntimeError( "playwright-cli is not installed. Install with: npm install -g @playwright/cli@latest" ) ``` ### Technical Analysis The documented dependency is the scoped npm package `@playwright/cli`, but the automatic fallback executes `npx playwright-cli`, referring to a different, unscoped package name. This path is reachable when `extract_sac_deploy_info.py` calls `build_pw_command()` and no `playwright-cli` executable is present in `PATH`, while `npx` is available. Depending on normal `npx` behavior and the local npm configuration, the command may retrieve and execute the mismatched package. The fallback therefore crosses a package trust boundary: code from a package other than the dependency identified by the Skill is allowed to execute with the invoking user's privileges. The project contains no evidence that this mismatch is intentional or malicious. ### Attack Path 1. A user invokes `scripts/extract_sac_deploy_info.py` as directed by the Skill. 2. The expected `playwright-cli` executable is absent from `PATH`. 3. `build_pw_command()` detects an available `npx` executable. 4. The helper constructs the command `npx playwright-cli` rather than invoking the documented `@playwright/cli` package. 5. `run_pw()` executes that command using `subprocess.run`. 6. If the unscoped package is not already installed, `npx` may retrieve it from the configured npm registry and execute its entry point. 7. Code supplied by that unintended dependency runs under the account exec ...[truncated 394 chars]
- Remediation
- ## Remediation Suggestions - Replace the unscoped fallback with the exact intended package: ```python return [npx, "--yes", "@playwright/cli@<reviewed-version>"] ``` - Pin a reviewed version rather than relying on a mutable latest release. - Prefer requiring an explicitly installed and verified `playwright-cli` executable instead of downloading a package during Skill execution. - Keep the package name consistent across the installation guide, runtime fallback, and error messages. - If automatic installation is retained, use a trusted registry configuration and verify the resolved package and version before execution.
