Repository navigation
fix(macos): verify Full Disk Access and re-arm notices - #11716
Conversation
Greptile SummaryThis PR replaces the former Full Disk Access probe (checking read access on the Safari Bookmarks plist) with a more reliable and conservative probe that attempts to open the per-user TCC database (
Confidence Score: 5/5Safe to merge — the probe correctly uses async I/O, the migration logic handles all tally shapes including the dismissed edge case, and the version bump is a well-contained, tested change. The new TCC database probe is straightforward: async open, error-code classification, and a conservative Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/macos-full-disk-access-status.ts | New module implementing the TCC database read probe; async I/O, clean error classification, injectable readProbe for testability. Minor: openForRead lacks try/finally around handle.close(), a theoretical FD leak on rare close failure. |
| src/main/macos-tcc-prompt-notice.ts | Adds noticeVersion: 2 versioning to the persisted tally; loadTally() correctly prioritises dismissed: true before version checks, re-arms all non-dismissed legacy tallies, and normalises malformed states to EMPTY_TALLY. |
| src/main/ipc/developer-permissions.ts | Delegates the full-disk-access case to getMacosFullDiskAccessStatus(); removes the old inline Safari-bookmarks probe and its node:os/path/fs imports. Clean refactor. |
| src/main/macos-full-disk-access-status.test.ts | New test file; covers granted, EACCES/EPERM→denied, ENOENT/ENOTDIR/EBUSY→unknown, and unsupported-platform path. |
| src/main/macos-tcc-prompt-notice.test.ts | Updated tests verify re-arming of both legacy tally shapes, permanent opt-out preservation, and both replay paths for versioned tallies. |
| src/main/ipc/developer-permissions.test.ts | Adds mock for getMacosFullDiskAccessStatus and a new integration test asserting the IPC handler surfaces the probe result correctly. |
Reviews (2): Last reviewed commit: "perf(macos): keep full disk probe off ma..." | Re-trigger Greptile
📝 WalkthroughWalkthroughThe change adds macOS Full Disk Access detection through a TCC database probe. It maps successful reads, permission errors, other failures, and non-macOS platforms to distinct statuses. Developer permission IPC now uses this helper. TCC prompt notice tallies now persist a version and normalize acknowledgment state. Tests cover detection outcomes, IPC delegation, legacy tally handling, dismissal preservation, and versioned replay fixtures. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/macos-full-disk-access-status.ts (1)
8-11: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueEdge case:
close()failure after successfulopen()is misclassified.In
openForRead, ifopen()succeeds buthandle.close()throws, the thrown error propagates into thecatchblock inprobeMacosFullDiskAccessat Line 36. The function then reportsdeniedorunknowneven though the read access itself succeeded. This is unlikely in practice, but it conflates a close failure with a permission failure.Consider closing the handle in a
finallyblock so a close error does not affect the granted-status determination, or ignore close errors explicitly.Proposed fix
async function openForRead(filePath: string): Promise<void> { const handle = await open(filePath, 'r') - await handle.close() + try { + // Read succeeded once open() resolves; a close failure should not affect the result. + } finally { + await handle.close().catch(() => {}) + } }Also applies to: 33-39
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 93cd8899-7251-41c8-85ed-e6ed526e9461
📒 Files selected for processing (4)
src/main/ipc/developer-permissions.test.tssrc/main/ipc/developer-permissions.tssrc/main/macos-full-disk-access-status.test.tssrc/main/macos-full-disk-access-status.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/ipc/developer-permissions.test.ts
- src/main/macos-full-disk-access-status.test.ts
Electron validation (commit
|
Follow-up: exact reported toast pathReproduced the user action on commit
This confirms the screenshot in the report was another visible symptom of the same false-positive probe, and this PR fixes it. |
* fix(macos): verify full disk access status * perf(macos): keep full disk probe off main thread


Summary
Grantedonly after a successful open,Deniedfor permission errors, andUnknownfor missing or unexpected probe failures.Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildValidated with:
pnpm vitest run --config config/vitest.config.ts src/main/macos-full-disk-access-status.test.ts src/main/ipc/developer-permissions.test.ts src/main/macos-tcc-prompt-notice.test.ts src/main/macos-tcc-prompt-watch.test.ts src/renderer/src/hooks/useMacosTccPromptNotice.test.tsx src/renderer/src/hooks/macos-tcc-prompt-notice-subscription.test.ts(56 tests)pnpm run typecheck:nodepnpm run check:code-quality:changedpnpm run check:max-lines-ratchetgit diff --checkDeniedand emitted noAUTHREQ_PROMPTINGlog event.AI Review Report
Reviewed the permission signal, persisted notice migration, renderer claim lifecycle, and helper-attributed TCC behavior. The former probe used
fs.access()with its default existence-only mode; the replacement opens the protected database read-only and conservatively preservesUnknownfor ambiguous failures. Migration coverage verifies that legacy acknowledged notices require a fresh TCC event, current acknowledgements remain silent, and legacy permanent opt-outs remain permanent.Cross-platform behavior was checked explicitly: the probe is runtime-gated to macOS, returns
Unsupportedelsewhere, builds the home path withpath.join, and changes no shortcuts, labels, shell commands, Git behavior, SSH routing, or workspace assumptions. The existing helper-attributed prompt watcher remains authoritative because the detached helper has an independent TCC identity.Security Audit
The probe opens only the known per-user TCC database path in read-only mode and closes it immediately; it never reads or exposes database contents. It accepts no renderer-controlled path, adds no command execution or dependency, and keeps the existing typed IPC status contract. Permission errors are reduced to status enums without leaking filesystem details.
Notes
macOS does not expose a public Full Disk Access status API. This change uses effective read access as the practical signal while keeping actual TCC prompt observation as the stronger reason to show guidance.