playwright-cli
microsoft/playwright-cli/skills/playwright-cli
- Type
- Skill
- Scanned
- Nov 13, 2026
- Version
- b21724888b81
- Files read
- 11
This skill teaches AI coding agents how to automate web browsers, capture screenshots or videos, and write or debug Playwright tests. Its biggest risk is that it pre-approves all playwright-cli and npx playwright commands without confirmation, allowing a malicious webpage that tricks the agent via prompt injection to upload local files, attach to a running browser, or execute local code.
What it can reach
- Browser
- Launches and controls web browsers (Chrome, Firefox, WebKit, Edge), executes JavaScript in pages, and can attach to an already-running Chrome or Edge session.
- Network
- Navigates to any internet or localhost URL, sends web requests from browser contexts, and intercepts or mocks network traffic.
- Files
- Uploads local files to web pages, and writes snapshots, screenshots, PDFs, videos, traces, downloads, saved auth states, and Playwright test files to disk.
- Shell commands
- Pre-approves all playwright-cli and npx playwright commands via allowed-tools, and instructs the agent to run npm and GitHub CLI (gh) commands when needed.
- Secrets
- Reads, modifies, and exports browser cookies, localStorage, and sessionStorage (including active login tokens), and can read the system clipboard.
Findings
-
HighOver-broad pre-approved command wildcards allow unprompted file upload, browser attachment, and code execution
skills/playwright-cli/SKILL.md:4
In skill hosts that enforce allowed-tools (such as Claude Code), the wildcard rules Bash(playwright-cli:*) and Bash(npx playwright:*) bypass user confirmation for every subcommand. Because this skill regularly reads untrusted web pages where prompt injection is realistic, a tricked agent can silently upload sensitive local files (via playwright-cli upload or drop --path), attach to the user's personal running Chrome or Edge browser (via playwright-cli attach), read the clipboard or download files (via playwright-cli run-code), or execute arbitrary local JavaScript/TypeScript on the host machine (via npx playwright test with a downloaded or untrusted config file). In addition, Bash(npx playwright:*) omits --no-install, allowing npx to fetch packages despite the documentation stating that package installation requires separate approval.
Fix: Restrict allowed-tools to safe, read-only or navigation subcommands (such as snapshot, goto, click, fill, and close) and require explicit user confirmation before upload, drop, attach, run-code, delete-data, kill-all, and npx playwright test; also remove the redundant Bash(npx playwright:*) entry or enforce --no-install.
-
LowSkill instructs the agent to prefer untrusted page-provided WebMCP tools over visible UI
skills/playwright-cli/SKILL.md:234
WebMCP allows any visited webpage, including embedded third-party iframes, to register custom tools with self-declared names, descriptions, input schemas, and annotations such as readOnly. Although the skill notes at the end of the section that WebMCP metadata comes from the page and is untrusted, it explicitly instructs the agent to prefer calling these page-provided tools whenever one matches the task. A malicious page or embedded cross-origin widget frame can register a deceptive tool (for example, a fake login or search tool) to intercept sensitive inputs meant for the main page UI or trigger unintended actions.
Fix: Do not instruct the agent to automatically prefer WebMCP tools; require verifying that the tool belongs to the expected top-level origin and ask for user confirmation before sending credentials or sensitive parameters to webmcp-call.
-
LowInstallation instructions use unpinned @latest npm packages
skills/playwright-cli/SKILL.md:415
When playwright-cli is not already installed, the skill instructs the agent to globally install @playwright/cli@latest from npm (and references/test-generation.md similarly uses npm init playwright@latest) without pinning a known-good version. If the upstream npm package were ever compromised in a supply-chain attack, following this instruction would install the untrusted release automatically once the user approves the install command.
Fix: Pin @playwright/cli and create-playwright to tested major/minor/patch versions or instruct users to install from their project lockfile rather than globally pulling @latest.
