fix(computer-use): guard unsafe Linux uinput fallback - #74171
Conversation
PRATHAMESH75
left a comment
There was a problem hiding this comment.
Reviewed against #74148 — this looks like a complete, correct fix for the reported trigger (Linux/X11 + cua-driver <0.13.1 + /dev/uinput not read+write accessible). Mapping the issue's asks to the diff:
- Detect in doctor —
doctor.py+ the pureuinput_safety.detect_uinput_leak_risk()predicate report the input path as unsafe while capture/inspection/window discovery stay available (the guard is per-action on input only). ✅ - Refuse input actions with an actionable error —
CuaDriverBackend._uinput_leak_guard()returns a refusalActionResultbefore an input session is declared or the driver is invoked, anduinput_leak_risk_action_result()carries the message. ✅ - Version boundary is right —
driver_version_is_vulnerable()treats0.13.0as vulnerable and0.13.1/0.14.0as safe, matching cua-driver-rs-v0.13.1 as the fixed release. ✅ - Conservative on the unknowns — an unparseable/
Noneversion and an accessible/dev/uinputboth preserve current behavior (returnNone), so the guard never guesses or over-blocks. ✅ - Probes the actual MCP command — the guard reads
_resolved_mcp_command(the binary_lifecycle_cororeally spawned) rather than independently re-resolving, so a fixed wrapper can't mask a vulnerable relocated executable (trycua/cua#1961). Nice detail. - The
--versionprobe short-circuits off-Linux/no-DISPLAY and is cached per backend instance, and/dev/uinputis only opened once the platform/DISPLAY/version triple still leaves risk open — so there's no cost on the common path.
Test coverage (test_uinput_safety.py, test_doctor.py, test_computer_use_uinput_guard.py) exercises the platform/display/version/accessibility matrix directly via the DI'd predicate. I don't see a gap. Nothing further needed from my side — this closes #74148.
Detect cua-driver versions affected by trycua/cua#2618 before native input on Linux/X11. Surface the unsafe combination in computer-use doctor, preserve capture-only access, and probe the exact manifest-resolved MCP executable.
ae53a41 to
db808fe
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Linux/X11 mitigation. The current backend sends native actions through _run_input_action() without this safety predicate (tools/computer_use/cua_backend.py:2648-2829), and upstream's merged fix confirms the underlying pre-0.13.1 leak.
Problems
tools/computer_use/doctor.py:732bases the new diagnostic onhealth_report'sdriver_version. Existing code explicitly recognizes that this value can disagree with the resolved executable's--version(tools/computer_use/doctor.py:102-150), buthermes_identityis only built after augmentation inrun_doctor()(tools/computer_use/doctor.py:843on current main). A vulnerable executable reported as a fixed version would therefore receive no doctor warning.
Suggested changes
- Resolve and normalize the executable version before augmentation, prefer it for this predicate, and add the mismatched-report regression.
This is an automated hermes-sweeper review.
| platform_value = report.get("platform") | ||
| if not isinstance(platform_value, str): | ||
| platform_value = sys.platform | ||
| driver_version = report.get("driver_version") |
There was a problem hiding this comment.
Please derive the guard version from the resolved binary's --version output, with this report field only as a fallback. health_report is already known to disagree with the executable version, so a report claiming 0.13.1 could hide a vulnerable 0.12.6 binary from computer-use doctor.
|
Addressed the sweeper finding in
Verification: |
Closes #74148
Summary
/dev/uinputXInput-master leak fixed by fix(cua-driver): avoid leaking XInput masters without uinput trycua/cua#2631hermes computer-use doctorwith an actionable degraded check when the exact unsafe combination is detected<0.13.1+ inaccessible/dev/uinputare all trueWhy
cua-driver issue #2618 documents a Linux/X11 failure in which the driver created an XInput master pair before opening
/dev/uinput. If opening uinput failed, the pair was not recorded for cleanup and repeated input attempts could leak additional master keyboard/pointer pairs.The ordering was fixed by trycua/cua#2631 and released in cua-driver-rs-v0.13.1. Because
0.13.1is currently a pre-release while the stable updater can still report0.12.6, Hermes needs a local fail-safe for affected Linux users.Safety behavior
The guard activates only when all four facts are known:
sys.platform == "linux"DISPLAYis set<0.13.1/dev/uinputcannot actually be opened read/writeUnknown/malformed versions preserve current behavior. Fixed drivers, non-Linux platforms, display-less sessions, and accessible uinput preserve current behavior. Fixed/irrelevant environments do not open
/dev/uinputunnecessarily.The remediation recommends upgrading the driver. It does not change device permissions, invoke privilege escalation, install a pre-release automatically, or alter service lifecycle.
Verification
Real Linux/X11 validation against installed cua-driver
0.13.1with inaccessible/dev/uinput:{ "platform": "linux", "driver_version": "0.13.1", "overall": "ok", "risk_checks": [] }A live Chrome/GitHub computer-use regression using
0.13.1completed an authenticated issue submission, followed by clean teardown with no local cua-driver process and no CUA XInput devices.Review provenance
Implementation used Tank/Claude Code under a constrained worktree. A separate local-only Codex review found that the first implementation could probe a wrapper rather than the actual manifest-relocated MCP executable. That blocking finding was fixed by recording and probing the exact launched command; the fresh post-fix review reported no blocking findings. Hermes independently reran the CI-parity test suite and live runtime checks.