Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-driver): refuse unsafe GNOME 50+ helper startup
injaneity53ffe137973e
diff --git a/libs/cua-driver/scripts/tests/test_wayland_helper_safety.mjs b/libs/cua-driver/scripts/tests/test_wayland_helper_safety.mjsnew file mode 100644index 0000000000..14812550a7--- /dev/null+++ b/libs/cua-driver/scripts/tests/test_wayland_helper_safety.mjs@@ -0,0 +1,84 @@+import assert from 'node:assert/strict';+import { register } from 'node:module';+import { readFile } from 'node:fs/promises';++const extension = new URL('../../wayland-helper/winrects@cua/extension.js', import.meta.url);+const counts = {};+const bump = key => { counts[key] = (counts[key] ?? 0) + 1; return 1; };+const stub = new Proxy(function () {}, {+ get: () => stub,+ apply: () => stub,+ construct: () => stub,+});+globalThis.helperMocks = {+ Gio: {+ _promisify() {},+ DBusExportedObject: { wrapJSObject: () => {+ bump('wrap');+ return { export: () => bump('export'), unexport: () => bump('unexport') };+ } },+ DBus: { session: {} }, BusType: { SESSION: 0 }, BusNameOwnerFlags: { REPLACE: 0 },+ bus_own_name: () => bump('own'), bus_unown_name: () => bump('unown'),+ },+ GLib: {+ get_monotonic_time: () => 0,+ timeout_add: () => bump('timer'), source_remove: () => bump('remove'),+ },+ Shell: { Screenshot: class {} },+ St: new Proxy({}, { get: () => class { constructor() { bump('actor'); return stub; } } }),+ Clutter: stub, Cogl: stub,+ cairo: new Proxy(function () {}, {+ get: () => globalThis.helperMocks.cairo,+ construct: () => { bump('cairo'); return stub; },+ }),+ Main: { layoutManager: stub },+};+register(`data:text/javascript,${encodeURIComponent(`+export async function resolve(specifier, context, next) {+ if (specifier.startsWith('gi://') || specifier.startsWith('resource:///') || specifier === 'cairo')+ return { url: 'mock:' + specifier + (specifier.endsWith('/config.js') ? new URL(context.parentURL).search : ''), shortCircuit: true };+ return next(specifier, context);+}+export async function load(url, context, next) {+ if (url.startsWith('mock:')) {+ const name = url.slice(5);+ let source;+ if (name.endsWith('/extension.js')) source = 'export class Extension {}';+ else if (name.includes('/config.js')) source = 'export const PACKAGE_VERSION = globalThis.shellVersion';+ else if (name.endsWith('/main.js')) source = 'export const layoutManager = globalThis.helperMocks.Main.layoutManager';+ else source = 'export default globalThis.helperMocks[' + JSON.stringify(name.replace('gi://', '')) + ']';+ return { format: 'module', source, shortCircuit: true };+ }+ const result = await next(url, context);+ if (new URL(url).pathname.endsWith('/extension.js')) return { ...result, format: 'module' };+ return result;+}+`)}`);++for (const version of ['50', '50.1', '50.beta', '50.rc', '51', '45', '46', '47', '48', '49']) {+ globalThis.shellVersion = version;+ const { default: Extension } = await import(`${extension}?${version}`);+ const helper = new Extension();+ for (const key of Object.keys(counts)) delete counts[key];+ if (Number.parseInt(version, 10) >= 50) {+ assert.throws(() => helper.enable(), {+ message: 'winrects@cua is unsupported on GNOME Shell 50 or newer for session safety',+ });+ assert.deepEqual(counts, {});+ helper.disable();+ assert.deepEqual(counts, {});+ } else {+ helper.enable();+ assert.equal(helper.GetVersion(), 10);+ assert.equal(counts.export, 1);+ assert.equal(counts.own, 1);+ assert.equal(counts.actor, 5);+ assert.equal(counts.timer, 1);+ helper.disable();+ assert.equal(counts.unexport, 1);+ assert.equal(counts.unown, 1);+ assert.equal(counts.remove, 1);+ }+}+const metadata = JSON.parse(await readFile(new URL('metadata.json', extension)));+assert.deepEqual(metadata['shell-version'], ['45', '46', '47', '48', '49']);diff --git a/libs/cua-driver/scripts/tests/test_wayland_helper_safety.py b/libs/cua-driver/scripts/tests/test_wayland_helper_safety.pynew file mode 100644index 0000000000..4eec7558e0--- /dev/null+++ b/libs/cua-driver/scripts/tests/test_wayland_helper_safety.py@@ -0,0 +1,14 @@+import shutil+import subprocess+from pathlib import Path++import pytest+++def test_wayland_helper_safety():+ node = shutil.which("node")+ if node is None:+ pytest.fail("Node >= 20.6 is required for the helper lifecycle test")+ subprocess.run(+ [node, str(Path(__file__).with_suffix(".mjs"))], check=True+ )diff --git a/libs/cua-driver/wayland-helper/README.md b/libs/cua-driver/wayland-helper/README.mdindex 460c8039e2..e5ba5d76d8 100644--- a/libs/cua-driver/wayland-helper/README.md+++ b/libs/cua-driver/wayland-helper/README.md@@ -47,15 +47,34 @@ It exposes `org.cua.WinRects` on the session bus:It runs in the shell's privileged context, so **no xdg-desktop-portal grant** isneeded (unlike libei/RemoteDesktop).+## GNOME Shell compatibility++GNOME 45–49 remain supported. GNOME 50 and newer are temporarily refused+for session safety following reports of session-ending crashes. This is+containment, not a fix for the underlying native crash. Without the helper,+window geometry, capture, activation, and the agent cursor are unavailable.++Existing v8/v10 users on GNOME 50 must run+`gnome-extensions disable winrects@cua` before further diagnostics and keep+it disabled. Replacing files does not unload an already-active extension.++API 10 is retained because the method set is unchanged. T3 Code's v10 does+not have this safety guard. Both installers overwrite an installed helper+of the same version, so whichever app installed last determines whether the+guard is present. Keep `winrects@cua` disabled on GNOME 50 regardless.+## Install```~/.cua-driver/packages/current/wayland-helper/install.sh# From a source checkout, use ./install.sh in this directory.# then log out/in once (GNOME loads extensions only at session startup)-gnome-extensions info winrects@cua # -> State: ACTIVE+gnome-extensions info winrects@cua```+On GNOME 45–49, expect State: ACTIVE. On GNOME 50 and newer, expect+OUT OF DATE or ERROR instead.+cua-driver auto-detects it at runtime (`wayland::shell_helper`). AX operationsstill work when it is absent, but pixel geometry, the Shell cursor, and safeforeground portal input are unavailable. cua-driver refuses focus-bound input@@ -97,7 +116,7 @@ any copy serve every client:first defined in T3 Code's Linux patch to Cua Driver 0.34.0([pingdotgg/t3code#16975](https://github.com/pingdotgg/t3code/pull/16975))and are adopted here unchanged, so T3 Code's v10 and this v10 are- interchangeable. Coordinate any new number with apps that bundle the helper.+ API-compatible (the safety restriction above differs). Coordinate any new number with apps that bundle the helper.- Installers never downgrade. `install.sh` and the cua-driver installers keepan installed helper whose version is newer than the bundled one, and say so.`install.sh --force` replaces it anyway.diff --git a/libs/cua-driver/wayland-helper/winrects@cua/extension.js b/libs/cua-driver/wayland-helper/winrects@cua/extension.jsindex cbc28880e8..b15beed326 100644--- a/libs/cua-driver/wayland-helper/winrects@cua/extension.js+++ b/libs/cua-driver/wayland-helper/winrects@cua/extension.js@@ -5,6 +5,7 @@ import St from 'gi://St';import Clutter from 'gi://Clutter';import Cogl from 'gi://Cogl';import Cairo from 'cairo';+import * as Config from 'resource:///org/gnome/shell/misc/config.js';import * as Main from 'resource:///org/gnome/shell/ui/main.js';import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';@@ -685,6 +686,8 @@ function drawBadgeChip(cr, glyph, filled, fillColor) {export default class WinRectsExtension extends Extension {enable() {this._captureClones = new Map();+ if (Number.parseInt(Config.PACKAGE_VERSION, 10) >= 50)+ throw new Error('winrects@cua is unsupported on GNOME Shell 50 or newer for session safety');this._impl = Gio.DBusExportedObject.wrapJSObject(IFACE, this);this._impl.export(Gio.DBus.session, '/org/cua/WinRects');this._nameId = Gio.bus_own_name(diff --git a/libs/cua-driver/wayland-helper/winrects@cua/metadata.json b/libs/cua-driver/wayland-helper/winrects@cua/metadata.jsonindex a2843ca98d..6be4464e7b 100644--- a/libs/cua-driver/wayland-helper/winrects@cua/metadata.json+++ b/libs/cua-driver/wayland-helper/winrects@cua/metadata.json@@ -2,6 +2,6 @@"uuid": "winrects@cua","name": "WinRects","description": "Expose window geometry, capture, cursor, and verified activation for cua-driver on Wayland.",- "shell-version": ["45", "46", "47", "48", "49", "50"],+ "shell-version": ["45", "46", "47", "48", "49"],"version": 10}