Fix cancellation of macOS user-verification prompts (#53790)

## Why

Keychain signing reconstructs its own authentication context, so invalidating the caller's context does not reliably cancel the context that owns the biometric prompt.

## What changed

Evaluate the stored key's access-control policy explicitly with `LAContext` before signing. On cancellation, invalidate that context and wait for its authorization callback before releasing the lifecycle lock, rejecting any late success. Reload the key with the authorized context and disable further interaction so signing cannot open another prompt.

## Testing

Update unit tests to cover waiting for cancellation completion and rejecting completed authorization after cancellation. Add an ignored macOS hardware test and setup instructions covering persisted Secure Enclave key reuse, signature verification, cancellation, retry signing, and cleanup.

GitOrigin-RevId: 4ea9756430c5649654e95e047d1666617503072c
This commit is contained in:
ben zhang
2026-10-13 22:40:57 +00:00
committed by copyberry
parent 6786dccbe7
commit 815ef9bbc4
10 changed files with 381 additions and 114 deletions
+14
View File
@@ -4935,6 +4935,7 @@ name = "codex-user-verification"
version = "0.0.0"
dependencies = [
"base64 0.22.1",
"block2",
"core-foundation 0.10.1",
"dirs",
"objc2",
@@ -10961,8 +10962,10 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48e0b8b339e0d9d2ed4416b7f93f9d4daadff7d4dd797f89867cde11aeac607"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2-security",
]
[[package]]
@@ -10977,6 +10980,17 @@ dependencies = [
"objc2-foundation",
]
[[package]]
name = "objc2-security"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a"
dependencies = [
"bitflags 2.13.1",
"objc2",
"objc2-core-foundation",
]
[[package]]
name = "objc2-ui-kit"
version = "0.3.2"