Skip to content

feat: shared browser with live view and operator take-over - #621

Closed
Pro-Nil wants to merge 1 commit into
BaaRai:mainfrom
Pro-Nil:feat/shared-browser
Closed

Pro-Nil wants to merge 1 commit into
BaaRai:mainfrom
Pro-Nil:feat/shared-browser

Conversation

@Pro-Nil

@Pro-Nil Pro-Nil commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Every agent run used to launch its own private headless Chromium through playwright-mcp. Nobody could see it, so a CAPTCHA, an email/SMS code, a 2FA prompt or a login stopped the run.

ARTEX now runs one persistent Chromium and points every browser MCP at it over CDP (--cdp-endpoint). Function -> Browser shows the agent's tab live (CDP screencast over SSE). Take over lets the operator solve the check or sign in; Hand back returns control, and the agent continues in the same tab with the same cookies.

  • Operator control: agent browser tools are refused with a wait message.
  • Human checks (reCAPTCHA, hCaptcha, Turnstile, Arkose, DataDome, GeeTest, PerimeterX, Google's unusual-traffic page, short "verify you are human" pages) block acting tools and tell the model to call ask_operator; reading tools stay available and asking releases the block.
  • One agent run drives the browser at a time (90 s idle lease; a run that asked the operator keeps it for up to 15 minutes while paused).
  • Persistent profile in /browser-profile; no --enable-automation, AutomationControlled off, HeadlessChrome removed from the user agent.
  • Chromium runs as the executor identity, so its DevTools port gives agent processes no more than their own rights.
  • -shared-browser=false / ARTEX_SHARED_BROWSER=false restores the old behavior; if Chromium cannot start, agents fall back to it.

Every agent run used to launch its own private headless Chromium through
playwright-mcp. Nobody could see it, so a CAPTCHA, an email/SMS code, a
2FA prompt or a login stopped the run.

ARTEX now runs one persistent Chromium and points every browser MCP at it
over CDP (--cdp-endpoint). Function -> Browser shows the agent's tab live
(CDP screencast over SSE). Take over lets the operator solve the check or
sign in; Hand back returns control, and the agent continues in the same
tab with the same cookies.

- Operator control: agent browser tools are refused with a wait message.
- Human checks (reCAPTCHA, hCaptcha, Turnstile, Arkose, DataDome, GeeTest,
  PerimeterX, Google's unusual-traffic page, short "verify you are human"
  pages) block acting tools and tell the model to call ask_operator;
  reading tools stay available and asking releases the block.
- One agent run drives the browser at a time (90 s idle lease; a run that
  asked the operator keeps it for up to 15 minutes while paused).
- Persistent profile in <data>/browser-profile; no --enable-automation,
  AutomationControlled off, HeadlessChrome removed from the user agent.
- Chromium runs as the executor identity, so its DevTools port gives agent
  processes no more than their own rights.
- -shared-browser=false / ARTEX_SHARED_BROWSER=false restores the old
  behavior; if Chromium cannot start, agents fall back to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful direction, but the current design is not safe to enable by default:

  1. The shared Chromium runs as the executor uid with --remote-debugging-port=0; a Bash tool from any task can read the port and drive CDP, bypassing the lock and the operator hand-back, and read cookies. Isolate or authenticate CDP per session/task, and make the feature opt-in.
  2. The profile is shared across tasks and chats under data/, where the web file manager can browse it. Use an isolated profile per task or session.
  3. --ignore-certificate-errors is enabled whenever capture is on; that disables certificate validation.
  4. --disable-blink-features=AutomationControlled and the HeadlessChrome rewrite are anti-bot evasion; remove them or gate them behind an explicit policy note.
  5. The ask_operator lock is 15 minutes and blocks the browser for all other tasks; make the timeout configurable and release it on hand-back or cancel.

Please rebase after the fixes; the tests should cover the CDP denial from an agent Bash and the lock release.

@BaaRai BaaRai closed this in 91da834 Nov 28, 2026
nohanbluu pushed a commit to nohanbluu/ARTEX that referenced this pull request Nov 28, 2026
…rofiles, and configurable lock (BaaRai#621)

Rebased onto main (5f5ec32) and hardened per security review:
- Opt-in only (-shared-browser / ARTEX_SHARED_BROWSER=true; default false); README and CHANGELOG accurately describe hardened behavior and document the residual risk of same-UID argv token visibility alongside per-message operator-hold/lease enforcement and immediate revocation.
- Isolates CDP via --remote-debugging-pipe on Unix (no Chromium DevTools TCP port or DevToolsActivePort) fronted by a per-run 256-bit token-authenticated server CDP proxy enforcing operator hold and active lease on every HTTP request and WebSocket message.
- Removes --ignore-certificate-errors from the capture path; trusts only ARTEX's capture CA SPKI pin (--ignore-certificate-errors-spki-list) and fails closed if unreadable.
- Removes --disable-blink-features=AutomationControlled and the HeadlessChrome user-agent rewrite (policy: hand challenges off via ask_operator).
- Isolates browser profiles per task or chat session under <data>/browser-profiles/<scope> using descriptor-relative openat(O_NOFOLLOW|O_DIRECTORY) + fchown + unlinkat with root-owned parent (no filepath.Walk over executor-owned trees), tested against root/scope/child symlinks.
- Makes operator lock / ask_operator hold timeout configurable via -shared-browser-lock-timeout / ARTEX_SHARED_BROWSER_LOCK_TIMEOUT (default 15m), auto-expiring idle locks.
Co-authored-by: Pranil Acharya <Pro-Nil@users.noreply.github.com>
@BaaRai

BaaRai commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Landed via #639 after hardening: opt-in and off by default, CDP over --remote-debugging-pipe behind a per-run token proxy that enforces the operator hold and lease on every request, capture CA SPKI pinning, no stealth flags, descriptor-relative profile isolation, and a configurable lock timeout. The residual same-UID argv token risk is documented. Thanks, Pranil Acharya.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants