Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(local-vm): start the driver's Chrome without its own sandbox (#4189)

Aditya Umale6af51394e98b
diff --git a/server/browser/chrome/host-setup.ts b/server/browser/chrome/host-setup.ts
index 6a57f80960..3c4d1c0c29 100644
--- a/server/browser/chrome/host-setup.ts
+++ b/server/browser/chrome/host-setup.ts
@@ -4,9 +4,11 @@
// OMB's command and environment names, and an AppArmor profile pinned to one
// exact executable instead of a wildcard path.
//
-// OMB never turns Chrome's sandbox off by itself. A host that cannot give it one
-// gets the setup command instead, and only an operator's explicit
-// OMB_BROWSER_SANDBOX=0 launches without it.
+// OMB never turns Chrome's sandbox off by itself on a host. A host that cannot
+// give it one gets the setup command instead, and only an operator's explicit
+// OMB_BROWSER_SANDBOX=0 launches without it. The computer container image (also
+// run on a VPS) is the exception: it drops capabilities, so its Chrome runs
+// without its own sandbox and the container is the isolation boundary.
import { execFile } from "node:child_process";
import { existsSync, readFileSync } from "node:fs";
diff --git a/server/container-computer.test.ts b/server/container-computer.test.ts
index d4c1a7bdb0..af106085a4 100644
--- a/server/container-computer.test.ts
+++ b/server/container-computer.test.ts
@@ -847,7 +847,14 @@ describe("Cua integration", () => {
expect(dockerfile).toContain("6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2");
expect(dockerfile).toContain("/usr/local/share/licenses/noto-cjk/OFL.txt");
expect(dockerfile).toContain("fc-cache -f");
- expect(IMAGE_LAYER_VERSION).toBe("7");
+ expect(IMAGE_LAYER_VERSION).toBe("8");
+ });
+
+ it("starts the driver's Chrome without its own sandbox inside the hardened container", () => {
+ // Without it Chrome exits with code 21 ("Failed to move to new namespace"): see the start-script comment.
+ const dockerfile = managedImageDockerfile();
+ const exec = dockerfile.split("\n").find((line) => line.includes(`${CUA_EXECUTABLE} serve`));
+ expect(exec).toContain("exec env CUA_DRIVER_BROWSER_NO_SANDBOX=1 ");
});
it("rejects a zero-byte OpenSSL base image before the wheel download needs curl", () => {
diff --git a/server/container-computer.ts b/server/container-computer.ts
index b2b5190ae2..ffd97680f0 100644
--- a/server/container-computer.ts
+++ b/server/container-computer.ts
@@ -30,7 +30,7 @@ export const BASE_IMAGE = `${BASE_IMAGE_REPOSITORY}@${BASE_IMAGE_DIGEST}`;
// localhost/ is explicit: Podman prepends it to unqualified build tags and may then resolve the name on Docker Hub.
// Image and container labels, not this mutable tag, decide compatibility.
export const IMAGE_REPOSITORY = "localhost/openmausbot/cua-local-vm";
-export const IMAGE_LAYER_VERSION = "7";
+export const IMAGE_LAYER_VERSION = "8";
export const IMAGE_LAYER_LABEL = "com.openmausbot.image-layer";
export const IMAGE = `${IMAGE_REPOSITORY}:driver-${CUA_DRIVER_VERSION}-v${IMAGE_LAYER_VERSION}`;
export const CONTAINER = "openmausbot-computer";
@@ -152,7 +152,7 @@ RUN set -eux; \\
echo '6a73f9541c2de74158c0e7cf6b0a58ef774f5a780bf191f2d7ec9cc53efe2bf2 /usr/local/share/licenses/noto-cjk/OFL.txt' | sha256sum -c -; \\
fc-cache -f
${workspacePreparationDockerfile(VM_WORKSPACE_GUEST)}
-# A bot's own desktop: a 200 ms (not 800) watch for windows an action opens still sees Firefox popups; no cursor glide; plain logs.
+# A bot's own desktop: a 200 ms (not 800) watch for windows an action opens still sees Firefox popups; no cursor glide; plain logs; Chrome's own sandbox off, since it needs namespaces this hardened container (capabilities dropped, runtime seccomp) refuses and Chrome exits with code 21; the container is the isolation boundary here.
RUN printf '%s\\n' \\
'#!/bin/sh' \\
'/usr/local/bin/prepare-openmausbot-workspace.sh' \\
@@ -162,7 +162,7 @@ RUN printf '%s\\n' \\
' if [ "$attempt" -ge 45 ]; then echo "X display :1 did not become ready within 45 seconds" >&2; exit 1; fi' \\
' sleep 1' \\
'done' \\
- 'exec env CUA_DRIVER_INSTALL_CHANNEL=python_package CUA_DRIVER_RS_TELEMETRY_ENABLED=0 CUA_DRIVER_WINDOW_CHANGE_TIMEOUT_MS=200 NO_COLOR=1 ${CUA_EXECUTABLE} serve --socket ${CUA_SOCKET} --permission-mode standard --cursor-reduced-motion on' \\
+ 'exec env CUA_DRIVER_BROWSER_NO_SANDBOX=1 CUA_DRIVER_INSTALL_CHANNEL=python_package CUA_DRIVER_RS_TELEMETRY_ENABLED=0 CUA_DRIVER_WINDOW_CHANGE_TIMEOUT_MS=200 NO_COLOR=1 ${CUA_EXECUTABLE} serve --socket ${CUA_SOCKET} --permission-mode standard --cursor-reduced-motion on' \\
> /usr/local/bin/start-openmausbot-cua-driver.sh \\
&& chmod 0755 /usr/local/bin/start-openmausbot-cua-driver.sh
RUN printf '%s\\n' \\