Skip to content

BrowserX 0.1.0

Latest

Choose a tag to compare

@kaan-zeroday kaan-zeroday released this 14 Nov 18:00
Immutable release. Only release title and notes can be modified.

BrowserX 0.1.0

First public release of BrowserX: a Rust service that supervises local Chromium processes, leases them to automation clients as sessions, keeps the state you ask it to keep, replaces browsers that die, hands a live session from one client to another, and exposes the pool to AI agents through an MCP server. For authorized security research and authorized automation only.

Pre-1.0: configuration keys, the HTTP API, command-line interface and on-disk formats can change between minor versions; every change is listed in the changelog. Source only: build with the pinned toolchain (cargo build --release --locked -p browserx, Rust 1.99.0, Chromium installed separately). No prebuilt binaries, container images or crates.io packages are published. License: AGPL-3.0-only.

Start with the README, then the documentation index. Report vulnerabilities privately (see the security policy).

Added

  • Backends. The worker can keep its lease registry in PostgreSQL or MariaDB ([database], with a required node per worker so workers sharing a database never touch each other's leases) and its sealed snapshots in an S3-compatible object store ([object_store], profiles standard, edge, self-hosted and compatible, request signing implemented in-tree); SQLite and the snapshot directory stay the default. The MCP server can share rate limits and call budgets through Valkey or Redis ([cache], falling back to in-memory limits when the cache is unreachable) and copy its audit log to ClickHouse ([analytics]), Kafka or RabbitMQ ([events]) and OpenSearch or Elasticsearch ([search]) with bounded buffers that drop and count instead of slowing a call. Every backend has a namespace (schema, database, key prefix, bucket prefix, topic or exchange prefix, index prefix) so several products can share one set of instances; secrets come from files or the environment only; unsupported combinations are refused when the configuration loads. Integration tests run against real services in throwaway podman containers (ci/run-backend-tests.sh, opt-in CI job backends). See Backends and the design page.
  • Audit export sinks (MCP). Optional copies of the hash-chained audit log to ClickHouse ([analytics]), Kafka or RabbitMQ ([events]) and OpenSearch or Elasticsearch ([search]): bounded non-blocking queues, batching, bounded retries, per-sink drop counters in capabilities, versioned schemas, namespaced by database, topic prefix, virtual host and exchange prefix, or index prefix.
  • Doctor checks the lease registry. browserx doctor --config opens the configured lease registry and reads from it once (PostgreSQL, MariaDB or an existing SQLite file), the same reachability /readyz reports while serving.
  • Sessions as leases. Durable lease records with an identity, an owner, a time-to-live with renewal, an absolute lifetime cap, an idle timeout, a lifecycle state machine (queued, allocating, active, idle, recovering, draining, lost, closed) and a fencing generation. Every lease change is a compare-and-swap on the expected generation; a lost swap surfaces as stale_generation.
  • Controller tokens. bxt_ lease tokens, returned once and stored only as SHA-256 digests, compared in constant time; rotated by handoff.
  • Snapshot key rotation. One active key seals new snapshots; retired keys (storage.retired_snapshot_key_files) open older ones.
  • Explicit persistence contracts. persistence is ephemeral, snapshot or profile; there is no boolean "persistent" flag. Snapshots capture cookies, per-origin localStorage and open page URLs, sealed with AES-256-GCM (metadata bound as associated data), versioned per profile, written atomically with mode 0600, pruned to snapshot_keep. Profile directories are created with mode 0700 under an exclusive lock.
  • Attach outcomes. Every attach reports resumed_same_process, restored_from_profile, restored_from_snapshot or fresh_process.
  • Recovery. Health monitor with unresponsive strikes, confirmed browser shutdown (graceful close, then process-group termination), relaunch with bounded attempts, recovery = "none" to end a session instead, and startup reconciliation of leases orphaned by a worker restart.
  • Handoff. Token rotation with generation increment; relay connections bound to the old token are closed.
  • Dedicated and shared isolation. One Chromium process per session, or one browser context per session in a warm shared browser behind a scoped CDP relay that injects the context into Target.createTarget, filters targets and events and refuses context, browser and system commands.
  • Scheduler. Bounded FIFO admission queue with a deadline, per-owner quotas, max_browsers, shared-browser slots, warm pool, retirement by age and by contexts served, reaper and periodic snapshotter.
  • Egress forwarder. A loopback forwarder per dedicated session: direct dialing with a destination policy that refuses private, loopback, link-local, carrier-grade NAT, multicast, reserved and metadata addresses (with an allow-list), or an upstream http://, https://, socks5:// or socks5h:// proxy with credentials kept out of the browser; plain-HTTP requests are tunnelled so CONNECT-only gateways work; {session} and {generation} username templates.
  • Launch profiles. Named browser launch configurations (executable, headless, flags, environment); managed flags cannot be overridden. {persona_seed} in flags expands to a stable per-identity number.
  • HTTP API. /v1/sessions (create, list, get, attach, renew, handoff, snapshot, release), /v1/profiles, /v1/launch-profiles, typed JSON errors with stable codes, and the authenticated /cdp/{session}/{token} WebSocket relay.
  • Operations. Ops listener with /healthz, /readyz and Prometheus /metrics; graceful shutdown on SIGINT and SIGTERM with final snapshots.
  • Command line. browserx serve, config check, keys new, snapshot-key new, doctor and the session client commands.
  • Documentation. Design pages (architecture, sessions and leases, persistence, recovery, handoff, isolation and security, egress) and guides (getting started, configuration, API, CLI, CDP clients, upstream proxy, launch profiles, operations).
  • Repository. CI with a code-owner authorization gate, linting, hashed public-hygiene checks, secret scanning, dependency policy (cargo deny) and a CodeQL and security workflow that runs once the repository is public.
  • AI/LLM-native operation. The positioning is next-generation AI/LLM-native browser pooling, session management, persistence, recovery and handoff for authorized security research: AI agents can watch, drive and explain BrowserX within limits an operator sets. Models advise and act through scoped tools and never authorize; leases, recovery, egress policy and the host-protection relay policy stay deterministic code, with no model in the data path. See AI/LLM-native operation.
  • MCP server (browserx-mcp, browserx mcp). A Model Context Protocol server (revisions 2026-07-28, 2025-06-18 and 2025-03-26) over stdio or streamable HTTP (--http, loopback by default, bearer token stored as a SHA-256 digest, constant-time comparison, Origin check, bodies bounded to 4 MiB). It talks to a worker through the public API and the operations listener. Read-only monitoring tools are always on (health, pool_status, assess, list_sessions, get_session, explain_session, explain_error, list_launch_profiles, list_snapshots, capabilities); sessions, handoff, browse, interact and evaluate are capabilities the operator enables one by one, and a tool that is not enabled is not listed. Includes browserx mcp check, browserx mcp token new and browserx mcp audit verify. See the MCP server guide and examples/mcp.toml.
  • Session tools for agents. create_session (persistence, isolation, launch profile, profile id, TTL, recovery, a named proxy route from configuration instead of credentials), renew_session, snapshot_session, release_session and handoff_session (both need confirm: true). The MCP server keeps the lease tokens; sessions it creates are labelled mcp=true and only controlled sessions can be browsed.
  • Browsing tools for agents. The MCP server connects to a session's cdp_url itself: open_page, page_snapshot (accessibility tree with stable element references that interactions re-resolve and refuse when stale), page_text (readable Markdown), screenshot (PNG, at most 2 MiB), tabs, go_back, go_forward, wait_for, network_log and console_log (bounded rings per tab), click, type_text, press_key, select_option, scroll, hover and, off by default, evaluate_js. When the browser behind a session was recovered, the next call reconnects and says what the recovery outcome means.
  • Deterministic scope and untrusted content. Navigation is confined to browse.allowed_origins and an optional engagement window: refused before the request, enforced on every top-level request including redirect hops while the browser is held at the request, and checked again on the final page. All page-derived text is wrapped in <untrusted_page_content origin="..."> with the wrapper neutralized inside the text. Lease tokens, CDP URLs, API keys and proxy credentials never reach the model.
  • Snapshot v2 and find_in_snapshot. page_snapshot returns a snapshot_id per tab and, with since, only the delta against an earlier snapshot (added, changed, removed, unchanged counts); same-process frames and open shadow roots are included under frame "<origin>" lines, cross-process frames are listed but not read, and a read filter can withhold frames by origin. Text hidden from users (zero-size, transparent, background-coloured, off-screen, aria-hidden) is omitted unless include_hidden is set and counted in hidden_omitted. Truncation says how many nodes were not shown. find_in_snapshot returns refs by accessible name, value or role from a stored snapshot.
  • Nonce-marked untrusted envelope. The untrusted block carries a fresh random nonce in its opening and closing tags and starts every line with a marker derived from it, so page text cannot predict or fake either.
  • Hash-chained audit log. Every tool call is appended to a JSONL log (mode 0600) with the operator, the authorization note and the engagement id; changing calls write an intent entry first and are refused if it cannot be written. browserx mcp audit verify finds edited, removed or reordered entries and prints the last hash for external anchoring. Typed text is recorded by length and digest.
  • Explanations and assessment. pool_status and assess turn background metric samples into windowed rates, a verdict (ok, saturated, degraded) and graded checks with evidence and remediation; explain_session and explain_error state what each status, recovery outcome and error code means and which state survived.
  • Optional model endpoint. [ai] (any chat-completions compatible endpoint) enables summarize_page, extract_data (validated against your JSON Schema) and diagnose. Each has a deterministic fallback and reports whether the model was used; the model sees only redacted, wrapped content.
  • Resources and prompts. browserx://docs/{sessions,persistence,recovery,handoff,security,egress,mcp} (bundled into the binary), browserx://sessions/{id}, and the prompts triage_session, capacity_review and explore_authorized_site.
  • Three protocol revisions on one engine. The MCP server serves 2026-07-28 (stateless: per-request _meta with the protocol version and client capabilities, server/discover, resultType, ttlMs and cacheScope on lists, and over HTTP MCP-Protocol-Version, Mcp-Method and Mcp-Name headers that must match the body or the request fails with HTTP 400 and -32020; an unserved version gets -32022 with the supported list), 2025-06-18 and 2025-03-26 (the initialize handshake). The revision is chosen per request. A W3C traceparent in _meta is accepted and recorded as trace_id in the audit log.
  • Typed tool results. Every tool has a title, an outputSchema and annotations (hints for clients, never used for enforcement); results carry structuredContent with a text copy; tools/list is sorted by name; validation failures are isError results. Screenshots are resource_links to browserx://screenshots/{id} (the last 16 are kept, readable with resources/read) for 2026-07-28 requests and inline images for older ones.
  • Action classes and profiles. Fixed code classifies every action on an element as read, navigate_in_scope, navigate_out_of_scope, form_edit, submit_state_change, credential_entry, external_communication, destructive, payment, file_transfer or unknown: structure first, a multilingual label table can only raise the class, contradictory evidence gives the stricter one. [safety] profile (read_only, test_environment by default, authorized_security_test) maps each class to allow, approval or deny for click, type_text, press_key, select_option and evaluate_js.
  • Human approvals. A consequential call answers input_required with an elicitation form and an AES-256-GCM requestState bound to the caller, tool, request, action, expiry and a single-use nonce (clients that declared elicitation on a 2026-07-28 request), or an approval_required error with an apr_... id that the operator approves with browserx mcp approvals list|approve (other clients). An approval covers one exact action once; confirm: true is never an approval.
  • Signed engagement manifest. [operator] keys_file and [manifest] load an operator-signed engagement.toml: engagement, hosts as attack, visit or blocked, protected requests, impact ceiling (observe, probe, demonstrate), rate and call limits and recurring UTC windows. An unsigned, altered, expired or out-of-window manifest unlists and refuses the page-changing tools (unsigned_manifest, window_closed). browserx mcp operator-key new, manifest verify and manifest sign manage the keys and signatures.
  • Signed scope grants and proposals. [grant] narrows a session to read-only and read-write origins, tools, action classes, budgets and an ordered plan; content outside the read origins is never returned, URLs built by the model and secret-looking values in them are guarded, and the server refuses to start with an unsigned grant or one wider than the manifest. propose_scope_grant lets a model propose a narrower grant for the operator to review and sign. browserx mcp grant verify and grant sign.
  • Session ledger (Rule of Two). Per session handle, three flags that only turn on (untrusted input read, sensitive context, a page-changing tool enabled); with all three set a consequential call is allowed with a warning, needs an approval or is refused, per [safety.rule_of_two] mode (off, warn, enforce, strict). engagement_status shows the flags and reset_context starts a fresh handle. Audit entries carry the handle, the flags, the action class, the refusal reason and the manifest state.
  • Adversarial evaluation. browserx agent eval --suite <path> --report <path> --seed <n> runs a versioned suite against the enforcement layers on a loopback fixture server with a real Chromium (exit status 2 when Chromium is missing) and writes a JSON report with an attempted, blocked and escaped matrix per layer; it exits 0 only with no deterministic escape and every case passing. A fault-injection build adds --mutate <layer> for harness self-tests.

Fixed

Review findings on the trust foundation (before its first release):

  • reset_context cannot be used to step out of the Rule of Two. Once a handle holds untrusted input or sensitive context the reset needs a human approval under enforce and is refused (reset_refused) under strict; it invalidates every element ref; and the call count, time budget and plan progress of a scope grant now belong to the principal, so a reset no longer refills a budget or rewinds a plan.
  • Persistent, profile_id and proxy-route sessions keep flag B on every use, after a reset and for every principal, as adopted sessions do.
  • Read-only origins are not places to act. With a scope grant, type_text, select_option, press_key, click and evaluate_js on a page outside rw_origins are refused (origin_not_in_rw).
  • Approvals. A used out-of-band approval is retired with its pending record (no second run, no second approval); one caller can no longer fill the pending table (deduplicated per caller, at most 16 per caller); names shown to a human lose direction-changing and invisible characters and have their quotes escaped; the elicitation message is redacted and bounded.
  • Action classification runs out of the page's reach. Element features are collected in an isolated world, so a page cannot lower a class by patching getAttribute, closest or URL; <button type="foo"> is a submit button; Enter in a field is classified by the request of the form's default button; frames in other processes are found for the screenshot guard (a frame with an unknown origin refuses the screenshot).
  • Protected requests. Patterns match the path as a server routes it (case, percent-encoding, dot segments, slashes, trailing slash, ;parameters, query kept apart), and the network hold checks them with the request's real method.
  • Scope grants. The exfiltration guard sees secrets in query keys and percent-encoded paths and fragments; a proposal can no longer drop the plan, raise budgets or move the window to count as narrowing; plan origins are normalized; screenshots count as untrusted input; links longer than a URL the browser would accept are not kept.
  • Manifest hosts. IDN hosts match by punycode and bracketed IPv6 literals are accepted.
  • HTTP. A 2026-07-28 header binds the request to that revision (-32020 for a body that does not declare it).
  • The container image builds. The Dockerfile now copies docs/ and examples/, which the MCP server embeds at build time.

Changed

  • MCP page-changing tools pass the action gate. click, type_text, press_key, select_option and evaluate_js are classified and decided by [safety] profile, which defaults to test_environment: credential entry, external communication, destructive actions, file transfers and unknown effects need an approval and payments are refused. Configurations without a [safety.rule_of_two] section keep working because the missing section means warn (recorded, never blocking); examples/mcp.toml sets enforce for new installs. tools/list is now sorted by name and each tool lists title, outputSchema and annotations.
  • CI runs only on self-hosted runners, and the workflow-lint job runs ci/check-self-hosted-only.py, which fails any job without the self-hosted label and any Dependabot configuration. Dependabot version updates are removed (.github/dependabot.yml is deleted): maintainers update dependencies and container base images by hand, and the security workflow keeps checking locked dependencies against current advisories.

Security

  • Session operations run to completion. Create, attach, renew, handoff, snapshot, release and profile deletion run in a tracked task, so a client that disconnects mid-call can no longer leak a browser, a context slot, a quota slot or a profile claim, or lose the outcome of a handoff. A profile claim is also released by a drop guard.
  • Stranded leases are reaped. The reaper now finishes leases left in draining or recovering (retry the release, release when expired, retry the recovery) instead of holding quota, the profile claim and a browser until restart.
  • Relay authentication is uniform and first. The relay answers 401 for a wrong token and for an unknown session, decided from a lock-free read before any session state is revealed or the session mutex is awaited; the /v1 operations check owner and token before queueing on the session too. Opening a relay no longer consumes the pending recovery outcome; only POST .../attach does.
  • Time arithmetic saturates. Lease times saturate at the far future instead of staying unchanged on overflow (which made a huge idle_timeout_secs or max_lifetime expire the session within a tick). A request's idle_timeout_secs may not exceed the maximum lifetime, and configured durations above ten years are rejected.
  • Shared-browser crashes no longer over-launch. A shared browser that is still launching counts as a candidate, so concurrent recoveries and creates wait for it instead of each starting a browser.
  • Host protection on every relay. Dedicated relays now parse CDP too (bounded) and refuse what turns the browser against the worker's host: navigation or target creation to file:, filesystem:, view-source:, chrome:, chrome-untrusted:, devtools:, internal about: pages and scheme-less URLs; Target.createBrowserContext with proxyServer or proxyBypassList (it bypassed the egress forwarder and its destination policy); DOM.setFileInputFiles, dragged host files and Extensions.*; Tracing.*, Memory.*, SystemInfo.*, Browser.close and Browser.crash*. Binary client frames are no longer forwarded. Shared relays apply the same rules. A refused command gets a CDP error and the connection stays open.
  • Downloads are confined. Browser.setDownloadBehavior and Page.setDownloadBehavior get downloadPath forced to a per-session directory under <state_dir>/downloads, which is removed with the session's last relay connection and emptied at startup.
  • Snapshot key leaves the state directory. The default storage.snapshot_key_file is now ./.browserx-keys/snapshot.key, and a key file inside storage.state_dir is rejected at startup, because browsers run as the worker's uid. Breaking: move an existing key file out of state_dir and update the path.
  • Shared relay hardening. Page-session traffic is limited to an allow-list of protocol domains (Tracing, Memory, SystemInfo, Extensions and unknown domains are refused; Storage commands naming another context are refused). Requests are tracked by (sessionId, id) with duplicate in-flight ids refused, so a reused id can no longer return an unfiltered Target.getTargets. Target.* events on page sessions are filtered to the session's context. A foreign attachment from a browser-wide Target.setAutoAttach is resumed and detached instead of being left to stall a sibling's popup. Pending entries are purged when a CDP session detaches or its target is destroyed, so unanswered commands cannot disable the relay.
  • Relay and listener limits. At most server.max_relay_connections_per_session (default 4) relay connections per session (429 beyond); shared-session messages are limited to server.scoped_relay_max_message_bytes (default 16 MiB, was 64 MiB); both listeners close connections that do not complete a request head within server.header_read_timeout_secs (default 10) and keep at most server.max_connections (1024) and server.ops_max_connections (64) connections.
  • Upstream proxy address is policy-checked. The forwarder resolves a tenant-supplied proxy.url host once, applies egress.block_private / egress.allow_cidrs to it and dials only the checked addresses. Every failure to reach the upstream proxy answers the same 502 upstream proxy is unavailable, so the proxy URL is no longer an oracle for internal hosts and ports. Breaking: an upstream proxy on a private or loopback address now needs its range in egress.allow_cidrs.
  • Browsers no longer outlive a crash unnoticed. Every launch writes <state_dir>/tmp/<browser_id>.json (owner, pid, process group, start time, user-data directory); the worker sweeps at startup, killing leftover browsers it can verify (process group, exact --user-data-dir= argument, start time) and removing stale temporary directories. The process group is signalled before the leader is reaped, so a recycled group id is never hit.
  • Proxy password is scrubbed. Both lease stores drop spec.proxy.password when a lease turns terminal, existing terminal rows are scrubbed on open, and SQLite runs with secure_delete. The database file and its -wal/-shm files are narrowed to 0600 on every open, not only at creation.
  • Snapshot capture no longer trusts the page. localStorage is read through the browser's DOMStorage domain for the origin the browser reports, not by script in the page, so a page cannot plant entries under another origin. Capture has a total budget of 48 MiB (below the 64 MiB sealed limit) and fails with a typed error that names it.
  • WebRTC cannot bypass the forwarder. Browsers behind a forwarder get --force-webrtc-ip-handling-policy=disable_non_proxied_udp; --force-webrtc-ip-handling-policy and --webrtc-ip-handling-policy are managed flags.
  • An oversized DevTools reply no longer retires a browser. The worker's control connection is reopened after a closed connection (and by health probes) instead of staying dead; an origin whose storage reply is too large is skipped. New runtime.cdp_max_message_bytes.
  • Secrets are zeroized and key files are strict. Secret, the rendered Proxy-Authorization header and SOCKS5 credentials are wiped on drop; the snapshot key is passed by reference as a Zeroizing buffer (Sealer::new takes &Zeroizing<[u8; 32]>). A key file must be owned by the current user and be 0600 or stricter (group access was only a warning); new key directories are created 0700.
  • Startup timeout is bounded. runtime.startup_timeout_secs above 600 is rejected, and the launch deadline uses checked arithmetic, so a huge value can no longer panic the launching task.
  • Dedicated relays refuse the CDP escape hatches. Target.exposeDevToolsProtocol (a page-side binding that opens a browser-level channel the relay never sees, and through it proxyServer, file: navigation and file selection), Target.openDevTools, Target.setRemoteLocations, Browser.getBrowserCommandLine and Browser.executeBrowserCommand are refused in the shared method_refusal path, so every relay mode refuses them. A dedicated relay also forwards only the protocol domains a shared relay allows on page sessions. PWA (PWA.launchFilesInApp takes host file paths, PWA.install a bundle URL) and Cast (media-router traffic bypasses the forwarder) are not among them and are refused by name as well, as are Tethering, domains a newer Chromium adds and unknown names. Real-Chromium tests drive a dedicated relay and re-check the file:, proxyServer and SystemInfo refusals.
  • Browsers do not inherit the worker's environment. Chromium starts with env_clear(), an allow-list (PATH, HOME, TMPDIR, LANG, LC_*, TZ, XDG_* directories, fontconfig and display variables) and the launch profile's env, so BROWSERX_DATABASE_PASSWORD, BROWSERX_OBJECT_STORE_* and other secrets never reach /proc/<browser>/environ. The worker's own environment is unchanged (see Known limitations).
  • The worker is non-dumpable. browserx serve calls prctl(PR_SET_DUMPABLE, 0) at startup (through nix, no unsafe), so other processes of the same user cannot read /proc/<worker>/environ or its memory, or ptrace it; browsers are unaffected because execve clears the flag. A same-user gdb -p or strace -p on the worker is refused (use root), and the worker writes no core dump.
  • The container keeps Chromium's sandbox on. docker/browserx.docker.toml no longer passes --no-sandbox; docker/seccomp-chromium.json (the default Docker profile with clone, unshare, setns and chroot allowed without a capability condition) is wired into the Compose file and the docker run examples. --no-sandbox is documented as an explicit opt-in with its risk.
  • Kafka SASL needs TLS. [events.sasl] without tls = true is refused unless allow_plaintext = true, also for a loopback bootstrap address, because brokers can advertise other addresses and the client follows them.
  • Container images are pinned by digest. The Dockerfile base images, ci/run-backend-tests.sh and the backend tests use name:tag@sha256:...; digest bumps are manual. ci/check-image-pins.py runs in CI and fails on any image without a digest.
  • Single-tenant worker hosts are documented. The DevTools port (random, 127.0.0.1) and the forwarders trust every local user; SECURITY.md and the deployment docs now require a single-tenant host or container, and record the maintainer rule never to approve a fork workflow run without reading its workflow diff.

Known limitations

  • Secrets that the worker reads from environment variables stay in its own environment, because the code base forbids unsafe and Rust 2024 makes remove_var unsafe. The worker is non-dumpable (PR_SET_DUMPABLE), so same-user processes cannot read them from /proc; use the *_file settings to keep them out of the environment altogether.
  • The relay and the API speak plaintext ws:// and http://; terminate TLS in front for anything beyond loopback or a trusted network.
  • Shared-browser isolation is not a boundary against hostile tenants.
  • Snapshots can be opened only by the active key or a key listed as retired; a snapshot sealed with any other key cannot be restored.
  • Snapshots do not carry the JavaScript heap, sessionStorage, IndexedDB, Cache Storage, service workers, open sockets or origins that were never opened.
  • Profile directories are not portable between machines or Chromium versions.
  • Configuration is read at start; there is no hot reload.