webcmd icon indicating copy to clipboard operation
webcmd copied to clipboard

Local-only use: configurable site-memory root, keep the Chromium sandbox, attach to an external browser for browser commands

Open chambers75 opened this issue 1 month ago • 4 comments

We evaluated webcmd 0.8.4 for a local research agent with strict data-confinement rules (WEBCMD_GLOBAL_MEMORY=off, WEBCMD_CANDIDATE_PUBLIC_IP=off). Three things block adoption:

  1. Site-memory root ignores config. site-memory/local-store.js:161–162,278–282 resolves sitesRoot from opts.homeDir → HOME, and the CLI builds the backends without options (cli.js:507). So WEBCMD_CONFIG_DIR/WEBCMD_CACHE_DIR cannot move learned memory. The only workaround is overriding HOME for the whole process. Request: a WEBCMD_SITES_DIR (or config key) honoured by the CLI.
  2. The browser always runs with --no-sandbox. It's added by Playwright's default and again by Cloak's buildArgs (cloakbrowser/dist/args.js:12–27), even with browser.kind: custom and a stock Chromium. Loading third-party pages (ads included) without the Chromium sandbox is a blocker for us. Request: an option that keeps the sandbox enabled (chromiumSandbox: true, with no --no-sandbox from the stealth args), at least for custom/chrome kinds.
  3. No external-CDP attach for browser/session commands. WEBCMD_CDP_ENDPOINT is read only in the Electron-adapter path (runtime.js:10–14, execution.js:168–183). Request: let browser run/sessions attach to an existing CDP endpoint, so users can supply their own hardened browser.

Also worth noting: candidate provenance stores the machine hostname and LAN IP (site-memory/environment.js). An opt-out like the public-IP one would help.

Positive results from the same trial: memory stayed fully local, the seed was never contacted with the switch off, and the two-date ingestion rule is a good safeguard. On a JS-gated page (a YouTube transcript), webcmd got the full content where plain HTTP got nothing.

chambers75 avatar Oct 20 '26 05:10 chambers75

@Agnik47 hey can you look into this? thanks! Seems like a good feature.

ngaurav avatar Oct 22 '26 10:10 ngaurav

Hey @ngaurav @Agnik47, I'd like to take point 3 (letting browser and session commands attach to an external CDP endpoint), if nobody has started on it yet. Happy to leave the sandbox and memory-root items to Agnik47.

Rough plan: add a remote CDP runtime provider alongside the existing cloak and slab providers, selected through config (browser.kind: "cdp" with an endpoint), with WEBCMD_CDP_ENDPOINT as an override. It would accept both ws:// and wss:// endpoints, so it covers a local hardened Chrome as well as hosted browsers. Sessions would map to browser contexts on the remote side, and closing a session would never shut down a browser webcmd didn't launch.

For context, I maintain browser-gateway, an open source router for remote browsers, so remote CDP is what I work on every day, and I'd love for webcmd to run on it out of the box. I'll keep the PR small and add tests next to the existing provider tests. Let me know if you'd prefer a different approach. Thank you

iNerdStack avatar Oct 23 '26 19:10 iNerdStack

Hi @ngaurav, I'd like to take the last item here: opt-outs for the hostname and LAN IP recorded in candidate provenance.

Plan: add WEBCMD_CANDIDATE_MACHINE=off and WEBCMD_CANDIDATE_LOCAL_IP=off, following the existing WEBCMD_CANDIDATE_PUBLIC_IP=off pattern in src/site-memory/environment.ts, with tests in environment.test.ts and a PRIVACY.md update. I'll stay out of the sandbox, memory-root and CDP parts (Agnik47 / iNerdStack).

Okay to go ahead?

SibgathKhan777 avatar Nov 09 '26 15:11 SibgathKhan777

Ran into the same wall from the other direction — we build diting, an agent browser whose engine is first-party (own CSS/layout/paint, JS in per-session isolated runtimes — no Chromium, no CDP), so your three asks read differently from here:

  1. Memory/config root: all persistent state (page cache, account cookie jars, session snapshots, search log) is one SQLite under ~/.diting, relocated wholesale via DITING_STORAGE_DIR (or cookies alone via DITING_COOKIE_STORE_DIR); DITING_EPHEMERAL runs with no persistence at all. One knob for the whole confinement boundary, no HOME tricks.
  2. Sandbox: the --no-sandbox problem disappears with the premise — there is no Chromium process tree. Third-party page code executes in the engine's per-session JS runtime, and the engine process is the only thing that needs confining (filesystem behind an allow-list flag, egress behind one optional proxy). Not claiming a smaller attack surface than a sandboxed Chromium renderer — a different, auditable one: no Blink in the path, no IPC to a broker process.
  3. External attach: we deliberately ship no CDP face, so there is nothing to attach to — the hardened browser is the product itself. If the confinement rules allow a local engine, an agent drives it over localhost HTTP (fetch/click/eval + recorded session flows) with no external browser anywhere in the chain.

The hostname/LAN-IP provenance point is a good catch regardless of stack — worth an opt-out symmetric to the public-IP one. And fair dues on the positive result: JS-gated page vs plain HTTP is exactly the class of win that keeps agents reaching for a real browser.

yinnho avatar Nov 09 '26 15:11 yinnho