Security Model
Playwriter is designed with multiple layers of protection to ensure safe browser automation:Localhost-Only by Default
The WebSocket relay server binds tolocalhost:19988 and only accepts local connections:
- No external network exposure: Cannot be accessed from other machines
- No remote execution risk: Malicious websites cannot connect
- Local-first design: All communication stays on your machine
Origin Validation
The relay server validates WebSocket connection origins:- Extension ID whitelist: Only our official extension IDs can connect
- Unforgeable origin: Browsers cannot spoof the
Originheader - Blocks unauthorized extensions: Other Chrome extensions are rejected
Explicit User Consent
Automation only works on tabs where you explicitly clicked the extension icon:- Per-tab opt-in: Click the extension icon on each tab you want to automate
- Visual indicator: Extension icon turns green when a tab is connected
- Easy disable: Click again to disconnect and stop automation
- No background automation: Cannot control tabs you haven’t explicitly enabled
Visible Automation
Chrome shows an automation banner on controlled tabs:- “Chrome is being controlled by automated test software”: Clear visual indicator
- No stealth mode: You always know when a tab is under automation
- Native Chrome behavior: Uses standard
chrome.debuggerAPI automation indicators
HTTP Route Protection
Privileged HTTP routes (CLI and recording endpoints) are protected against cross-origin attacks:Sec-Fetch-Sitevalidation: Blocks cross-origin browser requests- Content-Type enforcement: POST requests must use
application/jsonto prevent CORS preflight bypass - Token authentication: Required when
--tokenflag is set (remote access mode)
/cli/execute even though CORS alone only blocks reading responses.
Remote Access Security
When using remote access via tunnels, additional protections apply: On host machine:- Token authentication:
--tokenflag requires Bearer token on all requests - HTTPS tunnels: Use secure tunnels that encrypt traffic
- Audit access: Log files show all commands executed
- Revocable tokens: Change or remove the token to revoke access
What Playwriter Cannot Do
Cannot Access Non-Enabled Tabs
Even if the extension is installed, tabs where you haven’t clicked the icon are completely inaccessible. The extension only sees tabs with green icons.Cannot Access Restricted Pages
Chrome security policy prevents extensions from accessing:chrome://internal pageschrome-extension://pages from other extensions- Chrome Web Store pages
about:blankpages (shows black icon, clickable but no content)
Cannot Execute Without Permission
The MCP server and CLI require:- Extension installed and connected to relay server
- At least one tab with extension enabled (green icon)
- Valid session created via
playwriter session new
Architecture
- Extension: Connects to WebSocket server, controls tabs via
chrome.debugger - Relay Server: Localhost-only, validates origins, routes CDP commands
- MCP Client: Connects via WebSocket, sends Playwright commands
- Tab 3 (gray): Not controlled because user didn’t click extension icon
Best Practices
Use Session Isolation
Create separate sessions for different tasks:Store Sensitive Tokens Securely
When using remote access, store tokens in environment variables or secret managers:Monitor Log Files
Check relay server logs for unexpected activity:Review CDP Traffic
Inspect CDP command logs to audit automation:Use Explicit Page References
Always usestate.page to avoid ambiguity:
Threat Model
Protected Against
- Malicious websites: Cannot connect to localhost relay server
- Other extensions: Origin validation blocks unauthorized extensions
- Unauthorized tabs: Explicit opt-in required per tab
- Cross-origin attacks: HTTP route protection prevents CSRF-style attacks
- Token theft: Remote access requires explicit token setup
Not Protected Against
- Malicious code in execute commands: Agents can run arbitrary JavaScript in enabled tabs
- Physical access: Someone with access to your machine can control your browser
- Compromised agent: If your AI agent is compromised, it can control enabled tabs
- You trust the AI agent you’re using
- Your machine is secure (not compromised)
- You intentionally enabled specific tabs for automation
Reporting Security Issues
If you discover a security vulnerability, please report it privately:- Email: [email protected]
- GitHub: Use private vulnerability reporting