fix(cua-driver-rs)(macos): permissions status never reports the caller's grants#1774
Conversation
…r's grants `cua-driver permissions status` could print `✅ granted` even when `com.trycua.driver` had zero TCC grants: with no daemon listening it fell back to an in-process `check_permissions`, which reads the *calling* terminal's grants (macOS attributes TCC to the responsible process, not the executable path). The `Source: caller` label was the only tell, buried under two green checkmarks — a confident lie. Only the launchd bundle daemon (`driver-daemon` attribution, ppid==1) can read the driver's real grants. So: - Daemon up + `driver-daemon` attribution → report its answer (unchanged, reliable). - No daemon, OR a daemon answering with `caller` attribution (someone ran `cua-driver serve` by hand from a terminal) → report `❓ unknown` and emit NO accessibility/screen_recording booleans in `--json` (just `daemon_running:false, status:"unknown"`). Nothing downstream — human or script — can ever misread a false `granted: true`. Deletes the in-process caller fallback in `run_permissions_status`. The `grant` flow is unchanged. Docs (autostart, installation, faq) updated to describe the daemon-or-unknown behavior and point at `permissions grant` as the authoritative grant+verify path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughRefactored ChangesDaemon-only permissions status and documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
cua-driver permissions status, run standalone from a terminal, prints✅ grantedeven whencom.trycua.driverhas zero TCC grants:macOS attributes Accessibility / Screen-Recording to the responsible process (the LaunchServices launching app), not the executable path. With no daemon listening,
run_permissions_statusfell back to an in-processcheck_permissionsthat reads the calling terminal's grants. TheSource: callerlabel was the only signal it was lying — buried under two green checkmarks. A status command that confidently reports "granted" when the driver has nothing is worse than no command.Fix
The only process that can read
com.trycua.driver's real grants is the launchd bundle daemon (driver-daemonattribution,ppid==1). So:driver-daemon✅/❌ granted·Source: driver-daemon(reliable, unchanged)❓ unknown+ guidance — no booleans in--jsoncallerattribution)❓ unknown— its grants are the terminal's, not the driver'sThe in-process caller fallback in
run_permissions_statusis deleted.--jsonin the unknown case emits{"daemon_running": false, "status": "unknown", "reason": …}with noaccessibility/screen_recordingkeys, so no scripted consumer can ever misread a falsegranted: true. A missingsource(non-macOS, no TCC) is still trusted as-is.The
grantflow is unchanged — it already spawns via LaunchServices and verifies.Verified locally
❓ unknown, JSON has no booleans ✅serve(caller attribution) → now❓ unknown, not the oldcaller/granted✅driver-daemonpath → reports real grants (validated in fix(cua-driver-rs)(macos): bind serve socket before the permissions gate (#1761) #1773) ✅cargo build+cargo clippyclean;Cargo.locksynced to 0.3.5 (was drifted at 0.3.2).Docs
Updated
autostart.mdx,installation.mdx,faq.mdxto describe daemon-or-unknown behavior and point atpermissions grantas the authoritative grant+verify path.Closes the false-positive thread from the macOS TCC attribution series (follow-up to #1765/#1773).
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
cua-driver permissionsverbs handle attribution via the daemonpermissions statusreturns "unknown" when no daemon is runningBug Fixes