Repository navigation
fix(desktop): refuse pointer and key input when the session's Xvfb was replaced - #411
Merged
Merged
Conversation
Pointer input and key presses ran xdotool against the session display without checking that it still belonged to the session's Xvfb. If that Xvfb died and another server took the display number, the input could reach it. Every xdotool dispatch now verifies the owned Xvfb first, with the check typing uses, and refuses with DesktopInputTargetError. CLI and MCP evidence record the refusal as not-attempted. Closes #219.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pointer input and key presses ran xdotool against the display in the session record without checking that it still belonged to the session's Xvfb. If that Xvfb died and another X server took the display number, the input could reach the other server. Typing already checked this.
Every xdotool dispatch for click, double click, drag, move, scroll and key now verifies the session's owned Xvfb first (pid, start ticks, lock file and listening socket), with the same bounded check typing uses. It never reads host
DISPLAY,XAUTHORITYor home configuration. A mismatch refuses withDesktopInputTargetError, and CLI and MCP evidence record the action asnot-attempted. xdotool connects by display number, so a server that replaces the owned Xvfb in the few milliseconds between the check and that connection can still receive the input; the code documents this window.Key presses share the xdotool helper, so they are gated too, although #219 names only pointer input.
Proof: 13 new tests fail on
mainand pass here, and a CLI run against a real isolated Xvfb refused all six commands after another Xvfb took the display number, without moving its pointer.Reviewed with sol-loop: 1 round with GPT-6.1 Sol (xhigh). Sol verdict: not approved, see below.
main, where only click and drag record CLI evidence (evidence: show the agent cursor as a view-time overlay #199). Filed as cli: record evidence for every desktop input command #409.Closes #219
packages/desktop-linux/test/pointer-target.test.ts;~/.pickforge/investigations/219/qa-output.txtJ2, J3DISPLAYandXAUTHORITYset to other valuesrunXdotoolDISPLAY,XAUTHORITY,HOME; expired 3 s budgetpointer-target.test.tsnot-attempteddesktop-pointer-evidence.test.ts,desktop-input-captures.test.ts, QA evidence actionsdesktop click -- -1 5docs/releases/UNRELEASED.mdstill holds the tagged 0.7.1 notes until they are published and resetRelease note for the next version: "Desktop pointer input and key presses now verify that the display is still the session's own Xvfb before they send anything, as typing already did. If another X server took the display number, the action is refused and recorded as not attempted. (#219)"
Checks:
bun run typecheck,bun run lint,cargo build --release -p pickforge-viewer,bun run testandbun run test:coveragewith the CI environment variables, PickCheck (43 functions, no violations). Two tests failed locally only because this host'smiseshim forbunrejects a changedHOME; they pass with the realbunfirst onPATH.