T08 · Insecure Dependencies
- Location
scripts/playwright_utils.py:19- Finding
Unscoped npx Fallback May Execute an Unintended Registry Package
- Content
View full analysis
Vulnerability Details
File Location:
scripts/playwright_utils.py, lines 19–24
Vulnerability Type: Dependency confusion caused by an incorrect package fallback
Risk Level: HighVulnerable 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" )The installation instructions identify the intended dependency as the scoped package
@playwright/cli. However, when theplaywright-cliexecutable is unavailable, the fallback invokes:text npx playwright-cliThis resolves the unscoped registry package named
playwright-cli, not necessarily the documented@playwright/clipackage.Technical Analysis
The returned command is passed to
run_pw(), where it is executed throughsubprocess.run()with the current Agent or user privileges. Althoughshell=Falseprevents shell metacharacter injection, it does not address package identity:npxmay retrieve and execute code associated with the unintended unscoped package.The issue is reachable when all of the following conditions hold:
- The Skill runs
extract_sac_deploy_info.py. - No local
playwright-cliexecutable is found. npxis available.- The fallback command resolves the unscoped
playwright-clipackage from the configured npm registry.
This is classified as an insecure dependency flaw rather than malicious behavior because the reviewed project contains no evidence that the authors control the resolved package or intentionally seek to execute a malicious payload.
Attack Path
- A user invokes the Skill’s solution-information extraction workflow.
extract_sac_deploy_info.pycallsbuild_pw_command().- The expected
playwright-cliexecutable is absent, whilenpxis pres ...[truncated 1094 chars]
- The Skill runs
- Remediation
View remediation
Remediation Suggestions
- Remove the automatic
npxfallback and fail closed when the expected executable is unavailable. - If fallback execution is necessary, explicitly select the intended scoped package and pin its version, for example:
python return [ npx, "--yes", "--package=@playwright/cli@<reviewed-version>", "playwright-cli", ]- Keep the package version consistent with the installation guide and avoid
@latestin automated execution paths. - Verify the resolved executable or package identity before execution.
- Use a lockfile or controlled installation process where practical.
- Run the extraction helper in a restricted environment that does not expose Huawei Cloud credentials unless they are required.
- Document the exact trusted package name and version so installation and fallback behavior cannot diverge.
- Remove the automatic
