Skip to content

Use the new permission name on macOS 27+ and improve permission setup - #1442

Merged
lujjjh merged 1 commit into
mainfrom
fix/event-permission-recovery
Oct 10, 2026
Merged

lujjjh merged 1 commit into
mainfrom
fix/event-permission-recovery

Conversation

@lujjjh

@lujjjh lujjjh commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Use “Device Control and Data Access” instead of “Accessibility” on macOS 27 and later, matching the permission name in System Settings. Earlier versions keep “Accessibility” without the rename footnote.

The permission setup now explains why access is needed and opens System Settings directly, with a draggable app row (icon and name) in a floating guide that follows the Settings window. The whole row can be dragged; instructions describe adding it to the list without requiring a separate toggle step. The guide keeps its window ordering and mouse-event handling during the drag. It no longer triggers a separate system permission alert alongside the guide.

  • Update copy in all 35 supported languages, using Apple's permission names where available and English names for languages without a corresponding macOS localization.
  • Restart once after a newly observed accessibility grant, allowing event permissions to take effect even when the current process still reports denied access.
  • Check event-posting access alongside accessibility trust and use bounded retries for event-tap startup failures.
  • Preserve the runtime watchdog’s real event-tap probe and restart fallback, since permission status alone can remain stale after revocation. Run the probe off the main thread and ignore stale results after cancellation.

Related to #1436.

Validation

  • make test (Swift package tests and the app's complete test suite).
  • SwiftFormat across project source directories and SwiftLint on changed Swift files.
  • Exercised permission setup and recovery on macOS 27, including a grant that required restarting before event access updated.
  • Verified runtime revocation against the signed development app: resetting its Accessibility grant caused the real tap probe to fail at the next watchdog interval, followed by an automatic restart into permission setup.
  • All 1,135 app tests pass, including watchdog cancellation and restart coverage.
  • Tested version-specific naming and rendered both pre-27 and 27 variants. Older macOS versions have not been tested on actual installations.

Acknowledgment

The drag-to-authorize flow and floating guide adapt ideas and implementation details from PermissionFlow by 小弟调调. Its MIT license and copyright notice are included in LinearMouse/ThirdPartyNotices/PermissionFlow.txt, with attribution in the relevant source files. PermissionFlow is not added as a package dependency.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: linearmouse/linearmouse/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d06b172f-d0fe-4247-b176-7d25bb8af24b






📥 Commits

Reviewing files that changed from the base of the PR and between 03b0656 and aa526c0.







📒 Files selected for processing (17)
  • LinearMouse/AccessibilityPermission.swift
  • LinearMouse/AppDelegate.swift
  • LinearMouse/EventTap/EventTapRecovery.swift
  • LinearMouse/EventTap/GlobalEventTap.swift
  • LinearMouse/EventTap/GlobalEventTapWatchdog.swift
  • LinearMouse/Localizable.xcstrings
  • LinearMouse/ThirdPartyNotices/PermissionFlow.txt
  • LinearMouse/UI/AccessibilityPermissionView.swift
  • LinearMouse/UI/AccessibilityPermissionWindow.swift
  • LinearMouse/UI/PermissionAppDragSource.swift
  • LinearMouse/UI/PermissionDragPanel.swift
  • LinearMouse/UI/SettingsWindowFollower.swift
  • LinearMouseUnitTests/EventTap/EventTapRecoveryTests.swift
  • LinearMouseUnitTests/EventTap/GlobalEventTapWatchdogTests.swift
  • LinearMouseUnitTests/UI/PermissionAuthorizationProgressTests.swift
  • LinearMouseUnitTests/UI/PermissionGuidePlacementTests.swift
  • LinearMouseUnitTests/UI/PermissionNamingTests.swift






Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.








📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

This change updates permission checks, event-tap recovery, and the authorization interface. It adds a guided Settings flow with a draggable app icon, localized permission guidance, and restart handling based on permission snapshots.

Changes

Permission flow

Layer / File(s) Summary
Permission state and naming
LinearMouse/AccessibilityPermission.swift, LinearMouse/Localizable.xcstrings, LinearMouseUnitTests/UI/PermissionAuthorizationProgressTests.swift, LinearMouseUnitTests/UI/PermissionNamingTests.swift
Permission snapshots include AX, CoreGraphics, and IOHID results. Authorization progress can request a restart under defined permission and drag-state conditions. Settings-pane names vary by macOS version.
Event-tap recovery and permission loss
LinearMouse/EventTap/*, LinearMouseUnitTests/EventTap/*
Event-tap startup uses bounded recovery attempts and generation checks. A watchdog probes event access and invokes its failure callback when access is unavailable. Tests cover retries, stopped sessions, and probe results.
Guided Settings authorization
LinearMouse/AppDelegate.swift, LinearMouse/UI/*Permission*.swift, LinearMouse/UI/SettingsWindowFollower.swift, LinearMouse/Localizable.xcstrings, LinearMouse/ThirdPartyNotices/PermissionFlow.txt, LinearMouseUnitTests/UI/PermissionGuidePlacementTests.swift
The permission window opens Settings and follows its window while checking permission. A floating guide supports dragging the app icon into the permission list. The view displays localized instructions and recovery actions.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant AccessibilityPermissionView
  participant AccessibilityPermissionWindow
  participant SettingsWindowFollower
  participant PermissionDragPanel
  participant AccessibilityPermission
  participant Application
  User->>AccessibilityPermissionView: Select Open Settings
  AccessibilityPermissionView->>AccessibilityPermissionWindow: Begin authorization
  AccessibilityPermissionWindow->>SettingsWindowFollower: Start following Settings
  SettingsWindowFollower->>PermissionDragPanel: Report Settings window frame
  AccessibilityPermissionWindow->>AccessibilityPermission: Check permission snapshot
  AccessibilityPermission-->>AccessibilityPermissionWindow: Return permission snapshot
  AccessibilityPermissionWindow->>Application: Restart when authorization progress permits
Loading
















Merge Risk: ⚪ Minimal · up to aa526

The permission flow remains usable after a partial grant. No identified issue blocks merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to aa526

The redesign keeps macOS in control of access and limits recovery attempts. Cancellation prevents outdated permission results from restarting access. No permission bypass was established, but behavior across macOS grant and revocation states was not independently validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The sensitive capability in the inspected flow is session-wide input-event interception and manipulation within the user's macOS session. The PR changes how that existing capability starts and recovers; the inspected authorization paths do not establish new remote or cross-tenant authority.

Security Findings and Attack Paths

  • inferred — No permission-bypass path was established through the selected entrypoints. The strongest apparent exception—the authorization restart on AX grant before event access updates—only restarts the application. Subsequent startup requires the full permission predicate, and macOS can independently refuse tap creation.

Trust Boundaries and Controls

  • observed — The application opens a fixed Settings route and supplies its own bundle URL for manual drag-to-authorize. Settings-window metadata influences guide placement, not permission decisions. Authorization values come from macOS APIs, and the inspected guide does not programmatically grant access.

Resilience and Maintainability Implications

  • observed — Authorization cancellation invalidates pending results and stops polling and window following. Missing Settings windows restore the authorization entrypoint. Grant completion waits for dragging to finish, while runtime monitoring suppresses overlapping probes and ignores stale results after cancellation.









Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the main changes: the macOS 27+ permission-name update and improvements to permission setup.
Description check Passed The description directly explains the permission naming, setup flow, recovery behavior, testing, and attribution changes in the pull request.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR








🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@lujjjh
lujjjh force-pushed the fix/event-permission-recovery branch 5 times, most recently from 7ca5368 to 5878ec7 Compare October 10, 2026 13:36
@lujjjh
lujjjh force-pushed the fix/event-permission-recovery branch from 5878ec7 to 70dcfb0 Compare October 10, 2026 13:40
@lujjjh
lujjjh merged commit 4d84cf7 into main Oct 10, 2026
1 of 2 checks passed
@lujjjh
lujjjh deleted the fix/event-permission-recovery branch October 10, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant