Skip to content

Mac app: TouchID-based one-time helper authorization (no repeat admin prompts) #237

Description

@techmore

Problem

The Mac app re-prompts for admin credentials repeatedly instead of authorizing once and running for months. Also, the prompt is password-only (no TouchID).

Root cause (audited 2026-08-22)

  1. Install path uses osascript "do shell script ... with administrator privileges" (PrivilegeHelperClient.swift installHelper()). osascript admin prompts are password-only - macOS never offers TouchID for them - and the admin auth cache expires ~5 minutes per process.
  2. installationIsComplete has no version awareness: it checks reachability + file existence. Any app rebuild ships a new helper binary; if the installed daemon's protocol handshake fails (or binaries drift), the app reinstalls = new prompt. Dev builds are ad-hoc signed, so macOS treats every build as a different app.
  3. The helper daemon itself is stable (launchd shows running-since-boot, never exited) - the daemon architecture is fine; only the install/authorization flow needs work.

Fix plan

  1. Migrate to SMAppService.daemon.register() (macOS 13+; we require newer anyway). The system remembers the approval keyed to code signature, and the authorization dialog supports TouchID.
  2. Stable code signing: sign app + helpers with the Apple Development identity in build.sh instead of ad-hoc, so updates keep the same identity and approvals persist across versions.
  3. Version-stamped install handshake: helper writes protocolVersion + build hash to disk at install; app reinstalls only when actually incompatible (not on every rebuild).
  4. Scheduled auto-scans already run through the root helper via LaunchAgent, so once 1-3 land: one TouchID approval, then months of silent operation.

Current working state (for reference)

  • Daemon active: com.techmore.nmapui.nmap-helper (running since boot, 0 crashes)
  • Root nmap copy: /Library/PrivilegedHelperTools/com.techmore.nmapui.nmap
  • XPC contract: protocolVersion 4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions