fix(desktop): fall back to old keychain when DPK unavailable (unsigned builds)#1266
Merged
Conversation
…d builds) Unsigned/dev builds (tauri dev, hermit/cargo run) lack the hardened-runtime entitlement required by kSecUseDataProtectionKeychain. macOS returns errSecMissingEntitlement (-34018) and the app panics in the setup hook. Treat -34018 as "DPK unavailable" across all four SecretStore methods (probe/load/store/delete): when DPK returns that error, transparently retry via the legacy keyring crate path. Release builds (properly signed) continue using DPK with zero prompts. Dev builds fall back to old-keychain behavior (prompts once per key per session) without panicking. Windows/Linux paths are unchanged. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96
added a commit
that referenced
this pull request
Jun 25, 2026
Buzz stored each secret as a separate keychain item — the identity key plus one entry per managed agent (6 agents = 7 items total). On dev builds (old keychain, null ACL) every read and write triggers a prompt: 15-20+ on first launch. On release builds (DPK) the first launch prompts once per key (7 total). Goose solved this identically: one entry, all secrets as a JSON map, one prompt total. Switch SecretStore to the same pattern. A single blob entry (service = the store's service name, username = "secrets") holds all keys as a JSON map. The map is cached in-memory after the first read, so subsequent probe/load/store/delete calls within the same process never touch the keychain again. One prompt on first launch, zero after. Migration: on first launch after upgrade the blob doesn't exist yet. load() falls back to reading the old per-key DPK entry (macOS) or legacy keyring entry (all platforms), writes it into the new blob, and deletes the old item — one-time per key, transparent to callers. The is_dpk_unavailable (-34018) fallback from #1266 is incorporated here: unsigned dev builds fall back to the legacy keyring crate for the single blob entry. The probe/load/store/delete semantics seen by callers (IdentityKeyStore, KeyStore) are unchanged. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96
added a commit
that referenced
this pull request
Jun 25, 2026
Buzz stored each secret as a separate keychain item — the identity key plus one entry per managed agent (6 agents = 7 items total). On dev builds (old keychain, null ACL) every read and write triggers a prompt: 15-20+ on first launch. On release builds (DPK) the first launch prompts once per key (7 total). Goose solved this identically: one entry, all secrets as a JSON map, one prompt total. Switch SecretStore to the same pattern. A single blob entry (service = the store's service name, username = "secrets") holds all keys as a JSON map. The map is cached in-memory after the first read, so subsequent probe/load/store/delete calls within the same process never touch the keychain again. One prompt on first launch, zero after. Migration: on first launch after upgrade the blob doesn't exist yet. load() falls back to reading the old per-key DPK entry (macOS) or legacy keyring entry (all platforms), writes it into the new blob, and deletes the old item — one-time per key, transparent to callers. The is_dpk_unavailable (-34018) fallback from #1266 is incorporated here: unsigned dev builds fall back to the legacy keyring crate for the single blob entry. The probe/load/store/delete semantics seen by callers (IdentityKeyStore, KeyStore) are unchanged. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Unsigned and dev builds (
tauri dev, hermit/cargo run) lack the hardened-runtime entitlement required bykSecUseDataProtectionKeychain. macOS returnserrSecMissingEntitlement(-34018), which propagated up throughstore()→load_or_create_identity→ setup hook → panic.This was introduced in #1264, which switched the macOS keychain backend to Data Protection Keychain. Release builds (properly signed with hardened runtime) work correctly. Dev builds do not.
Fix
Add
is_dpk_unavailable(e: &SFError) -> boolthat checkse.code() == -34018. All four macOSSecretStoremethods (probe,load,store,delete) now have a fallback arm: when DPK returns -34018, they transparently retry via the legacykeyringcrate path — the same path used on Windows and Linux.Behavior after this fix
tauri dev/ hermit)Files changed
desktop/src-tauri/src/secret_store.rsonly