Skip to content

fix(security)!: enforce v2 authentication and companion lifecycle boundaries - #39

Merged
HMAKT99 merged 1 commit into
HMAKT99:mainfrom
zhixuli0406:codex/security-six-fixes
Oct 26, 2026
Merged

HMAKT99 merged 1 commit into
HMAKT99:mainfrom
zhixuli0406:codex/security-six-fixes

Conversation

@zhixuli0406

Copy link
Copy Markdown
Contributor

Summary

PAM authorization should depend on a phone signature over the exact transaction and administrator-enrolled trust. This proposes a coordinated protocol v2 migration across PAM, the daemon, installation helpers and the iPhone companion, with explicit revocation and verified companion lifecycle handling.

Refs #38. Keep the tracking issue open until the native acceptance items are completed.

Changes

  • Have PAM generate and retain canonical evidence binding a fresh nonce, Mac identity, UID/user, PID/service and expiry, then independently verify the phone proof against root-managed per-UID pins. Keep diagnostic approvals separate and fail closed on incompatible peers or missing proofs.
  • Move privileged module/trust/helpers under /Library/Security/TouchBridge; validate ancestors, permissions, symlinks and ACLs. Retire hooks before replacement/removal, preserve unrelated PAM entries and require explicit fingerprint enrollment before activation. Menubar administrator actions use protected helpers.
  • Pin the persistent Mac identity through QR, authenticate the ECDH transcript and exchange pairing tokens only inside the authenticated encrypted session. Bind device possession and full authorization context to the session; add bounded BLE framing/MTU handling.
  • Drive auto-lock from ordered verified-peer state, with fresh encrypted heartbeat leases, reconnect cancellation and positive OS lock-state readback. Unpair cancels reconnect and pending/late approvals, removes signing capability, and keeps failed cleanup disabled across restart.
  • Fix listener FD ownership across cancellation/restart and serialize mixed permanent-identity/paired-record Keychain operations at their shared native boundary, without retries or caches.
  • Disable the optional Authorization Plugin at its native entry until it has a privileged v2 verifier. Reject the source cask's old 1.1.2 artifact until reviewed v2 release metadata is available; source installation remains available.
  • Update the protocol/setup/security documentation and CI. Replace the old state-changing E2E script with an isolated regression driver.

Validation

  • bash tests/e2e-validation.sh: passed. Includes native PAM/migration/path checks, protected menu helper checks, native disabled-plugin C ABI checks, 25 protocol tests and 115 daemon tests.
  • swift build -c release --jobs 2 in daemon: passed.
  • make -C pam all: passed; universal arm64/x86_64 module and trust tool compiled.
  • xcodebuild test for the iOS scheme on an isolated simulator: 10 tests passed.
  • Unsigned generic iOS, Watch and macOS menubar builds: passed.
  • Shell syntax, Ruby cask syntax, CI YAML parsing and git diff --check: passed.
  • Patch applies cleanly to upstream base 35ccbfa7e01b2b1426194661f68c7e1cdb6c86a7.

These are local results. Upstream CI status is reported separately by GitHub checks.

Compatibility and remaining gates

Draft: maintainer review and native acceptance are required before merge/release.

  • This is a breaking migration: rebuild both ends, re-pair, compare fingerprints independently and enroll trust as an administrator. Do not authorize enrollment through a legacy phone-approval path.
  • V1 peers and Android/Watch/web/browser/simulator paths are not privileged v2 fallbacks; the optional Authorization Plugin is unavailable.
  • Physical iPhone BLE/Secure Enclave/Face ID, background behavior, privileged enrollment/revocation, actual PAM password fallback/migration/recovery and actual screen locking remain unverified. No production PAM configuration was changed during local validation.
  • Extended ACL entries are conservatively rejected, including inherited/deny entries. Do not weaken shared directory permissions to work around refusal.
  • The heartbeat lease establishes authenticated liveness, not distance bounding; a live bidirectional relay to an online phone can extend apparent proximity.
  • No signed/notarized v2 package or release is included. The cask intentionally refuses the currently published v1 artifact until a matching reviewed v2 URL/digest is available.

…ndaries

Require root-pinned canonical phone proofs, authenticated BLE pairing, complete transaction binding, verified presence leases and fail-closed unpairing. Protect privileged installation helpers and add regression coverage for migration, socket descriptor ownership and mixed Keychain operations.

BREAKING CHANGE: Rebuild Mac and iPhone components, re-pair, compare public-key fingerprints and enroll root-managed trust. V1 and diagnostic approvals cannot authorize v2 PAM. Native acceptance remains required before release.
@zhixuli0406
zhixuli0406 marked this pull request as ready for review October 25, 2026 11:22
@HMAKT99
HMAKT99 merged commit fb089eb into HMAKT99:main Oct 26, 2026
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.

2 participants