Repository navigation
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 requirednodeper worker so workers sharing a database never touch each other's leases) and its sealed snapshots in an S3-compatible object store ([object_store], profilesstandard,edge,self-hostedandcompatible, 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 jobbackends). 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 incapabilities, versioned schemas, namespaced by database, topic prefix, virtual host and exchange prefix, or index prefix. - Doctor checks the lease registry.
browserx doctor --configopens the configured lease registry and reads from it once (PostgreSQL, MariaDB or an existing SQLite file), the same reachability/readyzreports 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 asstale_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.
persistenceisephemeral,snapshotorprofile; there is no boolean "persistent" flag. Snapshots capture cookies, per-originlocalStorageand open page URLs, sealed with AES-256-GCM (metadata bound as associated data), versioned per profile, written atomically with mode0600, pruned tosnapshot_keep. Profile directories are created with mode0700under an exclusive lock. - Attach outcomes. Every attach reports
resumed_same_process,restored_from_profile,restored_from_snapshotorfresh_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://orsocks5h://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,/readyzand Prometheus/metrics; graceful shutdown onSIGINTandSIGTERMwith final snapshots. - Command line.
browserx serve,config check,keys new,snapshot-key new,doctorand thesessionclient 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 (revisions2026-07-28,2025-06-18and2025-03-26) over stdio or streamable HTTP (--http, loopback by default, bearer token stored as a SHA-256 digest, constant-time comparison,Origincheck, 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,interactandevaluateare capabilities the operator enables one by one, and a tool that is not enabled is not listed. Includesbrowserx mcp check,browserx mcp token newandbrowserx mcp audit verify. See the MCP server guide andexamples/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_sessionandhandoff_session(both needconfirm: true). The MCP server keeps the lease tokens; sessions it creates are labelledmcp=trueand only controlled sessions can be browsed. - Browsing tools for agents. The MCP server connects to a session's
cdp_urlitself: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_logandconsole_log(bounded rings per tab),click,type_text,press_key,select_option,scroll,hoverand, 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_originsand 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_snapshotreturns asnapshot_idper tab and, withsince, only the delta against an earlier snapshot (added, changed, removed, unchanged counts); same-process frames and open shadow roots are included underframe "<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 unlessinclude_hiddenis set and counted inhidden_omitted. Truncation says how many nodes were not shown.find_in_snapshotreturns 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 anintententry first and are refused if it cannot be written.browserx mcp audit verifyfinds 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_statusandassessturn background metric samples into windowed rates, a verdict (ok,saturated,degraded) and graded checks with evidence and remediation;explain_sessionandexplain_errorstate what each status, recovery outcome and error code means and which state survived. - Optional model endpoint.
[ai](any chat-completions compatible endpoint) enablessummarize_page,extract_data(validated against your JSON Schema) anddiagnose. 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 promptstriage_session,capacity_reviewandexplore_authorized_site. - Three protocol revisions on one engine. The MCP server serves
2026-07-28(stateless: per-request_metawith the protocol version and client capabilities,server/discover,resultType,ttlMsandcacheScopeon lists, and over HTTPMCP-Protocol-Version,Mcp-MethodandMcp-Nameheaders that must match the body or the request fails with HTTP 400 and-32020; an unserved version gets-32022with the supported list),2025-06-18and2025-03-26(theinitializehandshake). The revision is chosen per request. A W3Ctraceparentin_metais accepted and recorded astrace_idin the audit log. - Typed tool results. Every tool has a
title, anoutputSchemaand annotations (hints for clients, never used for enforcement); results carrystructuredContentwith a text copy;tools/listis sorted by name; validation failures areisErrorresults. Screenshots areresource_links tobrowserx://screenshots/{id}(the last 16 are kept, readable withresources/read) for2026-07-28requests 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_transferorunknown: structure first, a multilingual label table can only raise the class, contradictory evidence gives the stricter one.[safety] profile(read_only,test_environmentby default,authorized_security_test) maps each class to allow, approval or deny forclick,type_text,press_key,select_optionandevaluate_js. - Human approvals. A consequential call answers
input_requiredwith an elicitation form and an AES-256-GCMrequestStatebound to the caller, tool, request, action, expiry and a single-use nonce (clients that declaredelicitationon a2026-07-28request), or anapproval_requirederror with anapr_...id that the operator approves withbrowserx mcp approvals list|approve(other clients). An approval covers one exact action once;confirm: trueis never an approval. - Signed engagement manifest.
[operator] keys_fileand[manifest]load an operator-signedengagement.toml: engagement, hosts asattack,visitorblocked, 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 verifyandmanifest signmanage 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_grantlets a model propose a narrower grant for the operator to review and sign.browserx mcp grant verifyandgrant 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_statusshows the flags andreset_contextstarts 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 status2when Chromium is missing) and writes a JSON report with an attempted, blocked and escaped matrix per layer; it exits0only with no deterministic escape and every case passing. Afault-injectionbuild adds--mutate <layer>for harness self-tests.
Fixed
Review findings on the trust foundation (before its first release):
reset_contextcannot 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 underenforceand is refused (reset_refused) understrict; 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_idand 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,clickandevaluate_json a page outsiderw_originsare 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,closestorURL;<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-28header binds the request to that revision (-32020for a body that does not declare it). - The container image builds. The Dockerfile now copies
docs/andexamples/, which the MCP server embeds at build time.
Changed
- MCP page-changing tools pass the action gate.
click,type_text,press_key,select_optionandevaluate_jsare classified and decided by[safety] profile, which defaults totest_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 meanswarn(recorded, never blocking);examples/mcp.tomlsetsenforcefor new installs.tools/listis now sorted by name and each tool liststitle,outputSchemaand annotations. - CI runs only on self-hosted runners, and the
workflow-lintjob runsci/check-self-hosted-only.py, which fails any job without theself-hostedlabel and any Dependabot configuration. Dependabot version updates are removed (.github/dependabot.ymlis deleted): maintainers update dependencies and container base images by hand, and thesecurityworkflow 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
drainingorrecovering(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
401for 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/v1operations check owner and token before queueing on the session too. Opening a relay no longer consumes the pending recovery outcome; onlyPOST .../attachdoes. - Time arithmetic saturates. Lease times saturate at the far future instead of staying unchanged on overflow (which made a huge
idle_timeout_secsormax_lifetimeexpire the session within a tick). A request'sidle_timeout_secsmay 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:, internalabout:pages and scheme-less URLs;Target.createBrowserContextwithproxyServerorproxyBypassList(it bypassed the egress forwarder and its destination policy);DOM.setFileInputFiles, dragged host files andExtensions.*;Tracing.*,Memory.*,SystemInfo.*,Browser.closeandBrowser.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.setDownloadBehaviorandPage.setDownloadBehaviorgetdownloadPathforced 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_fileis now./.browserx-keys/snapshot.key, and a key file insidestorage.state_diris rejected at startup, because browsers run as the worker's uid. Breaking: move an existing key file out ofstate_dirand update the path. - Shared relay hardening. Page-session traffic is limited to an allow-list of protocol domains (
Tracing,Memory,SystemInfo,Extensionsand unknown domains are refused;Storagecommands 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 unfilteredTarget.getTargets.Target.*events on page sessions are filtered to the session's context. A foreign attachment from a browser-wideTarget.setAutoAttachis 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 (429beyond); shared-session messages are limited toserver.scoped_relay_max_message_bytes(default 16 MiB, was 64 MiB); both listeners close connections that do not complete a request head withinserver.header_read_timeout_secs(default 10) and keep at mostserver.max_connections(1024) andserver.ops_max_connections(64) connections. - Upstream proxy address is policy-checked. The forwarder resolves a tenant-supplied
proxy.urlhost once, appliesegress.block_private/egress.allow_cidrsto it and dials only the checked addresses. Every failure to reach the upstream proxy answers the same502 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 inegress.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.passwordwhen a lease turns terminal, existing terminal rows are scrubbed on open, and SQLite runs withsecure_delete. The database file and its-wal/-shmfiles are narrowed to0600on every open, not only at creation. - Snapshot capture no longer trusts the page.
localStorageis read through the browser'sDOMStoragedomain 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-policyand--webrtc-ip-handling-policyare 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 renderedProxy-Authorizationheader and SOCKS5 credentials are wiped on drop; the snapshot key is passed by reference as aZeroizingbuffer (Sealer::newtakes&Zeroizing<[u8; 32]>). A key file must be owned by the current user and be0600or stricter (group access was only a warning); new key directories are created0700. - Startup timeout is bounded.
runtime.startup_timeout_secsabove 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 itproxyServer,file:navigation and file selection),Target.openDevTools,Target.setRemoteLocations,Browser.getBrowserCommandLineandBrowser.executeBrowserCommandare refused in the sharedmethod_refusalpath, so every relay mode refuses them. A dedicated relay also forwards only the protocol domains a shared relay allows on page sessions.PWA(PWA.launchFilesInApptakes host file paths,PWA.installa bundle URL) andCast(media-router traffic bypasses the forwarder) are not among them and are refused by name as well, as areTethering, domains a newer Chromium adds and unknown names. Real-Chromium tests drive a dedicated relay and re-check thefile:,proxyServerandSystemInforefusals. - 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'senv, soBROWSERX_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 servecallsprctl(PR_SET_DUMPABLE, 0)at startup (throughnix, nounsafe), so other processes of the same user cannot read/proc/<worker>/environor its memory, orptraceit; browsers are unaffected becauseexecveclears the flag. A same-usergdb -porstrace -pon the worker is refused (use root), and the worker writes no core dump. - The container keeps Chromium's sandbox on.
docker/browserx.docker.tomlno longer passes--no-sandbox;docker/seccomp-chromium.json(the default Docker profile withclone,unshare,setnsandchrootallowed without a capability condition) is wired into the Compose file and thedocker runexamples.--no-sandboxis documented as an explicit opt-in with its risk. - Kafka SASL needs TLS.
[events.sasl]withouttls = trueis refused unlessallow_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.shand the backend tests usename:tag@sha256:...; digest bumps are manual.ci/check-image-pins.pyruns 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.mdand 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
unsafeand Rust 2024 makesremove_varunsafe. The worker is non-dumpable (PR_SET_DUMPABLE), so same-user processes cannot read them from/proc; use the*_filesettings to keep them out of the environment altogether. - The relay and the API speak plaintext
ws://andhttp://; 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.