fix(cua-driver): fail closed on unproven Wayland window capture - #2964
fix(cua-driver): fail closed on unproven Wayland window capture#2964injaneity wants to merge 1 commit into
Conversation
|
I’m validating the exact candidate |
|
Hyprland runtime result for exact candidate Environment: Arch/Omarchy, Hyprland 0.56, mixed Wayland+XWayland, two outputs at 1.25×/1.5×. I launched the repo-owned Electron fixture as a true XWayland window on inactive workspace 98 while workspace 1 remained active. Blocker before readiness: this patch refuses screenshots for every Wayland window, not only the unproven Hyprland/off-workspace case. That conflicts with the accepted Sway window/capture contract and the canonical matrix, whose PX rows require I’m adapting this existing PR rather than opening a competitor: rebase onto current |
|
I could not push directly to this repository branch (GitHub returned 403), so the reviewed adaptation is available as draft stacked PR #3052, whose base is this PR branch—not |
|
Updated stacked adaptation #3052 to exact candidate |
Preserve visible compositor-attested Wayland capture while refusing off-workspace or otherwise unproven surfaces before output or X11 pixels are read. Add a source-built Sway/XWayland public-interface regression row with workspace, focus, fixture-state, file-absence, and protocol oracles. Salvaged from #2964. Co-authored-by: injaneity <44902825+injaneity@users.noreply.github.com>
Preserve visible compositor-attested Wayland capture while refusing off-workspace or otherwise unproven surfaces before output or X11 pixels are read. Add a source-built Sway/XWayland public-interface regression row with workspace, focus, fixture-state, file-absence, and protocol oracles. Salvaged from #2964. Co-authored-by: injaneity <44902825+injaneity@users.noreply.github.com>
Fail closed when Wayland window-scoped capture cannot prove that output pixels belong to the requested surface. Preserve truthful accessibility output, explicit display capture, visible compositor-attested capture, and X11 per-window capture. Add a representative Sway/XWayland off-workspace regression row. Salvaged from #2964. Co-authored-by: injaneity <44902825+injaneity@users.noreply.github.com>
|
This fix has shipped in #3200 (merge commit The landed history preserves @injaneity’s contribution: it was based on |
What changed
surface_identity_unprovenscreenshot error while preserving the truthful accessibility tree fromget_window_stateWhy
On opted-in Wayland,
get_window_statecaptured the current output and cropped it using the requested window geometry. For an off-workspace XWayland window, those coordinates can select unrelated pixels from the active workspace and present them as the target window.Output capture and geometry do not prove surface identity. Until a compositor-backed identified per-window capture path is available, omitting the screenshot is safer than returning plausible pixels from another application.
Fixes #2962.
User impact
Wayland window-scoped capture now omits unprovable pixels and reports:
{ "screenshot_frame_valid": false, "screenshot_error": { "code": "surface_identity_unproven" } }The accessibility tree remains available. Explicit full-display screenshots remain available, and X11 per-window capture is unchanged.
Validation
Candidate:
4bdee4c2119780d43d9e60cf3f44afda9c0c91cbcargo fmt --check --allgit diff --checkwayland_window_capture_fails_closed_without_using_x11_pixelsx11_window_capture_keeps_the_existing_per_window_pathsurface_identity_failure_is_a_typed_screenshot_errorcargo test -p platform-linux --lib: 264 passed, 0 failed, 4 existing environment-dependent tests ignoredRuntime limitation
This host has no Hyprland binary/process,
hyprctl, Wayland/X11 display variables, or desktop session bus. The exact Hyprland + XWayland off-workspace topology from #2962 could not be reproduced here, so this PR claims source-level and unit-level verification only. The regression test proves the unsafe output/X11 fallback is not invoked at the dispatch boundary; compositor runtime certification remains outstanding.