Skip to content

fix(vault): require user presence instead of the current biometry set - #11

Merged
yasyf merged 1 commit into
mainfrom
fix-vault-user-presence
Nov 17, 2026
Merged

yasyf merged 1 commit into
mainfrom
fix-vault-user-presence

Conversation

@yasyf

@yasyf yasyf commented Nov 17, 2026

Copy link
Copy Markdown
Owner

cookiesync auth on the Mac Studio prints Touch ID authentication was cancelled or denied right after a correct passcode entry. Nothing was cancelled. The unified log for every failed run since 01:02 today reads:

authkit: vault-batch-retrieve: SecItemAdd failed: The user name or passphrase you entered is not correct. (OSStatus -25293)

This is the vault's copy of the bug #3 fixed in the attestor. The vault ACL was [.biometryCurrentSet, .or, .devicePasscode], and macOS binds that flag to the current fingerprint database at SecItemAdd. This Studio has no usable Touch ID right now. coreauthd reports -13 Accessory disconnected and biometry not enrolled and bioutil -c counts zero templates, so coreauthd logs Failed to get bio database hash and the add fails with errSecAuthFailed. batchRetrieve hit it on re-enrollment. Because enroll deletes the old item before adding the new one, the first failure left the vault item gone, and every later tap went through the same failing re-enroll. HelperFailure.failed exits 1, the same code as a denial, so cookiesync reported it as a cancelled prompt.

A standalone probe on this Mac reproduces the split: evaluateAccessControl(.createItem) fails with LAError -1000 for the old ACL and succeeds for .userPresence.

The ACL becomes .userPresence, which needs Touch ID or the device passcode, the same policy the sheet already evaluates. As in #3, the only loss is invalidation when a finger changes. The passcode already satisfied the old ACL, and an invalidated item was silently re-enrolled under whatever context had just authenticated, so that binding never gated anything. Existing items keep their ACL until they next re-enroll.

A failed evaluation also names its LAError code on stderr, such as denied (LAError -2), instead of a bare denied, so a caller can show what happened. The changelog cuts 0.3.0, which had shipped from Unreleased, and adds 0.3.1.

The flags move to Vault.accessControlFlags, and a headless test pins .userPresence and checks that .biometryCurrentSet is absent.

`cookiesync auth` on the Mac Studio prints `Touch ID authentication was cancelled or denied` right after a correct passcode entry. Nothing was cancelled. The unified log for every failed run since 01:02 today reads:

```
authkit: vault-batch-retrieve: SecItemAdd failed: The user name or passphrase you entered is not correct. (OSStatus -25293)
```

This is the vault's copy of the bug #3 fixed in the attestor. The vault ACL was `[.biometryCurrentSet, .or, .devicePasscode]`, and macOS binds that flag to the current fingerprint database at `SecItemAdd`. This Studio has no usable Touch ID right now. coreauthd reports `-13 Accessory disconnected and biometry not enrolled` and `bioutil -c` counts zero templates, so coreauthd logs `Failed to get bio database hash` and the add fails with `errSecAuthFailed`. `batchRetrieve` hit it on re-enrollment. Because `enroll` deletes the old item before adding the new one, the first failure left the vault item gone, and every later tap went through the same failing re-enroll. `HelperFailure.failed` exits 1, the same code as a denial, so cookiesync reported it as a cancelled prompt.

A standalone probe on this Mac reproduces the split: `evaluateAccessControl(.createItem)` fails with LAError -1000 for the old ACL and succeeds for `.userPresence`.

The ACL becomes `.userPresence`, which needs Touch ID or the device passcode, the same policy the sheet already evaluates. As in #3, the only loss is invalidation when a finger changes. The passcode already satisfied the old ACL, and an invalidated item was silently re-enrolled under whatever context had just authenticated, so that binding never gated anything. Existing items keep their ACL until they next re-enroll.

A failed evaluation also names its LAError code on stderr, such as `denied (LAError -2)`, instead of a bare `denied`, so a caller can show what happened. The changelog cuts 0.3.0, which had shipped from Unreleased, and adds 0.3.1.

The flags move to `Vault.accessControlFlags`, and a headless test pins `.userPresence` and checks that `.biometryCurrentSet` is absent.
@yasyf
yasyf merged commit 81dd9aa into main Nov 17, 2026
5 checks passed
yasyf added a commit to yasyf/cookiesync that referenced this pull request Nov 17, 2026
… claiming a cancel (#26)

Yasyf's `cookiesync auth` on the Mac Studio printed `Touch ID authentication was cancelled or denied` right after he typed his passcode correctly. He had not cancelled anything.

**What happened:** authkit's `vault-batch-retrieve` authenticated, then failed to re-enroll the vault item with `SecItemAdd failed: ... (OSStatus -25293)`. The vault ACL needed a fingerprint database this Mac does not have right now. authkit exits 1 for a failed operation as well as for a denied sheet, which is the helper contract's documented 1 = failed/denied/cancelled. `ObtainKeys` and `ObtainKeyBiometric` turned every exit 1 into a cancel message and dropped the helper's stderr, which named the real error.

**The change:** exit 1 now becomes a `ConsentError` carrying the helper's stderr:

```go
case 1:
	return nil, &ConsentError{Msg: fmt.Sprintf("Touch ID key release failed: %s", bytes.TrimSpace(res.Stderr))}
```

The same failure now reads `Touch ID key release failed: authkit: vault-batch-retrieve: SecItemAdd failed: ... (OSStatus -25293)`, and a real cancel reads `... denied (LAError -2)` once authkit 0.3.1 lands. The error type and its `Denied` verdict stay the same, so routed consent behaves as before.

**The enrollment fix itself** is yasyf/authkit#11, which moves the vault to a `.userPresence` ACL.

**Tests:** `TestObtainKeysWholeBatchFailures` adds an exit-1 case with the `SecItemAdd` stderr. It asserts the message carries the OSStatus and never says "cancelled". The denied-sheet case now asserts the LAError detail.

The changelog cuts 0.35.1.
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.

1 participant