Skip to content

Browser Automation

The browser tool wraps a Playwright MCP server. Multi-layered security — SSRF guard, DNS-rebinding backstop, input sanitization, JS execution restrictions, audit logging.

Terminal window
npx playwright install chromium
ActionArgsPurpose
navigateurlOpen a URL
clickrefClick an element by accessibility reference
typeref, textType text into an input
select_optionref, valueSelect from a dropdown
hoverrefHover an element
press_keykeyPress a keyboard key
screenshotCapture the current page as an image
snapshotAccessibility tree (structured page content)
evaluateexpressionExecute JS in the page context
waittimeWait for a duration
tabNewurl?Open a new tab
tabCloseClose the current tab
tabSwitchSwitch between open tabs
tabListList open tabs
goBack / goForwardNavigation history

NavigationGuard before every navigate:

  • Address blocklist: RFC 1918 (10.x, 172.16-31.x, 192.168.x), loopback (127.x, ::1), link-local (169.254.x), IPv6 unique-local (fc00::/7).
  • Encoding-obfuscation resistant — catches octal, decimal, hex IP encodings.
  • Post-navigation DNS backstop — verifies resolved IP didn’t switch to a private range after page load.
  • Protocol allowlisthttp: / https: only.
  • Length caps — hostname ≤ 253, path ≤ 2048, total URL ≤ 8192.

Full DNS-rebinding pinning at socket-connect is tracked as follow-up work (see Security).

InputGuard before every browser call:

  • Element refs — max 512 chars, shell metacharacters blocked.
  • Key names — must match ^[A-Za-z0-9+\-_]{1,64}$.
  • No raw user input reaches evaluate() without sanitization.

The evaluate action blocks a set of dangerous patterns via regex:

  • fetch() + XMLHttpRequest — data exfiltration
  • eval() + Function() — arbitrary code
  • localStorage, sessionStorage, document.cookie — credential theft
  • WebSocket — covert channels

The regex blocklist is trivially obfuscatable in principle (see Security tracked H3). Migration to a proper AST allow-list is a known follow-up.

Open localhost:3000, take a screenshot of the login page, and check if the form is accessible
Navigate to our staging site, fill in the registration form with test data, and verify the success page
Open the dashboard, click the "Export" button, and verify the CSV download contains the expected columns

Agent-driven browsing runs through the Playwright MCP server and needs no dedicated CodeBuddy settings — configure the server under codebuddy.mcp.servers like any other MCP integration.

The one related setting controls how CodeBuddy opens plain external URLs (news links, reader):

{ "codebuddy.browserType": "system" }
ValueBehavior
systemOpen in the OS default browser (default)
simpleOpen in a lightweight built-in webview
readerOpen in the Smart Reader panel
  • Security — SSRF guards, DNS-rebinding status, planned H3 refactor
  • Tools — the browser tool in the broader tool list