hex/native
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dax 341046f8d6
macos 27.3: require keystroke permission for paste, request it, and fail visibly (#2757)
* macos 27.3: require keystroke permission for paste, request it, and fail visibly

macOS 27.3 splits the old Accessibility grant into Accessibility (assistive
technologies) and System & App Protection Override (apps that control other
apps, posting ⌘V included). The Accessibility grant no longer proves Hex may
post a keystroke, so setup read Ready from AXIsProcessTrusted alone, never
asked macOS, and CGEventPost silently dropped every paste while Hex logged a
successful delivery and wrote History.

- Setup counts only the post-event preflight on 27.3+, reusing the native
  27.3 version check already used for the pane's name; below 27.3 nothing
  changes. Allow now calls CGRequestPostEventAccess so macOS can list Hex and
  post its Privacy & Security notification, during setup and in the "fix it"
  flow.
- The post-event preflight keeps its launch-time answer, so a row that stays
  untrusted after a grant reads "Needs a restart" and offers Restart Hex in
  the tour, and the Settings row does the same instead of running a tccutil
  reset that would drop the grant the person just made.
- A paste that would post a keystroke refuses before touching the clipboard
  when 27.3+ has not granted posting, with a HUD error naming System & App
  Protection Override. The shared delivery path already keeps the text for
  Paste last dictation and writes no History entry on a failed insert.

Docs note the 27.3 behavior and that no 27.3 device has verified it.

* macos 27.3: restart once per grant, explain a refused paste, and guard captures

Review fixes for the 27.3 keystroke grant.

- Restart Hex was a dead end: every stale Accessibility row on 27.3 offered
  it, so a grant that never landed looped between "Needs a restart" and a
  launch, and the tour row had no way back to the guide. The one restart is
  now recorded in onboarding-accessibility-restart (cleared when
  Accessibility reads Ready, and by a setup reset or identity change). After
  that restart a stale row falls back to the existing "Still grey? Fix it"
  reset-and-prompt flow, in the tour and in Settings > Permissions needed.
- A refused paste's HUD notice was gated by Labs > Failure notices (off by
  default), so the one failure that needs a person to act showed nothing. Its
  message is now a shared constant that the HUD explains regardless of the
  lab, through tr() with the six main languages and the four extra ones.
- Captures take the same check before touching the clipboard: Paster's
  paste_capture and the capture hand-off. The capture helper's Allow asks
  with CGRequestPostEventAccess so 27.3 can list Hex.
- The keystroke check runs before Labs > Return to app brings another app
  forward, so a refusal doesn't switch apps for a paste that cannot land.
- CGRequestPostEventAccess is a safe fn; request_post_event_access returns
  () and logs its answer instead of returning a bool no caller could use.
  The reset flow's request stays: after the restart fallback it is reachable
  again.

Docs now say what the person sees, which tests cover it, and that the
refusal itself has not run on a 27.3 device.

* macos 27.3: re-arm the restart after a reset, and explain a refused paste last

Second review fixes.

- After the one Restart Hex, "Still grey? Fix it" could never succeed: the
  marker was only cleared on Ready/setup reset/identity change, so reset ->
  grant still showed the reset row and Restart never came back. The reset
  dispatch now clears the one-restart marker for Accessibility on 27.3, so
  every cycle is reset -> grant -> one restart, user-driven. The poll re-reads
  it; Flow and Settings tests cover restart -> stale -> reset -> stale ->
  Restart again.
- A refused Paste Last only played the error tone. It now sends the same
  capture-level failure the dictation path uses, so the HUD notice explains it
  even with Labs > Failure notices off; other Paste Last failures keep the tone
  and log only. A refused capture hand-off still only logs, and the docs now
  say so instead of claiming every path shows the notice.
- Record the one restart only for the Accessibility row: the tour's
  restarts_for_post_event and the Settings stale row's restart. A Screen
  Recording or microphone Restart no longer spends it.
- Clear the marker only when accessibility_restart_done is set, and skip the
  marker stat entirely below 27.3.
2026-11-24 16:00:56 -05:00
..
permission_guide.m macos 27.3: require keystroke permission for paste, request it, and fail visibly (#2757) 2026-11-24 16:00:56 -05:00
voice_processing_guard.h Labs: voice isolation for dictation on macOS and iOS (#2425) (#2429) 2026-11-22 17:00:41 -05:00
voice_processing_guard.m Labs: voice isolation for dictation on macOS and iOS (#2425) (#2429) 2026-11-22 17:00:41 -05:00