Skip to content

fix(desktop): always use legacy keyring for blob entry on macOS#1271

Merged
wpfleger96 merged 2 commits into
mainfrom
duncan/keychain-blob-fix
Jun 25, 2026
Merged

fix(desktop): always use legacy keyring for blob entry on macOS#1271
wpfleger96 merged 2 commits into
mainfrom
duncan/keychain-blob-fix

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

Problem

DPK and the legacy keyring are separate OS stores. A blob written by a signed build (DPK) is invisible to dev builds (legacy keyring) and vice versa. A user who ran the signed v0.3.32 release — which migrated per-key entries into a DPK blob via #1267 — then switched to tauri dev would get Ok(None) for every agent key, because the dev build reads from the legacy keyring (empty).

Fix

Always use the legacy keyring crate for the blob on macOS. Both signed release and unsigned dev builds now share the same store. The legacy keyring is still the macOS Keychain — secure, just the older SecKeychain API rather than SecItem/DPK.

The per-key DPK migration path in migrate_legacy_key is unchanged: it still reads old DPK entries on signed builds for the one-time upgrade from the #1264 per-key format.

Changes

  • read_blob_raw (macOS): delegates directly to read_blob_raw_keyring instead of trying DPK first
  • write_blob_raw (macOS): delegates directly to write_blob_raw_keyring instead of trying DPK first
  • Removes now-unused set_generic_password_options import
  • Updates module doc comment to reflect the new approach

Behavior

Build type Blob store Result
Signed release Legacy keyring ✅ Shared with dev builds
Unsigned dev (tauri dev) Legacy keyring ✅ Shared with release builds

Follows #1267.

DPK and the legacy keyring are separate OS stores — a blob written by a
signed build (DPK) is invisible to dev builds (legacy keyring) and vice
versa. A user who ran the signed v0.3.32 release (which migrated per-key
entries into a DPK blob) then switched to `tauri dev` would get
Ok(None) for every agent key because the dev build reads from the legacy
keyring, which is empty.

Fix by always using the legacy keyring crate for the blob on macOS.
Both signed release and unsigned dev builds now share the same store.
The legacy keyring is still the macOS Keychain — secure, just the older
SecKeychain API rather than SecItem/DPK.

The per-key DPK migration path in migrate_legacy_key is unchanged: it
still reads old DPK entries on signed builds for the one-time upgrade
from the #1264 per-key format.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 force-pushed the duncan/keychain-blob-fix branch 2 times, most recently from 3acde94 to 69e4b49 Compare June 25, 2026 04:18
…load cache-hit test

Three more correctness fixes:

1. load_blob() now only populates the cache when it is still None, preventing
   a cold reader from overwriting a newer cache entry written by mutate_blob()
   between the two lock acquisitions.

2. DPK blob migration now uses mutate_blob() with entry().or_insert_with() so
   existing legacy values are preserved on conflict (legacy wins).

3. Adds a non-ignored load() cache-hit test that runs in CI without the OS
   keychain.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 force-pushed the duncan/keychain-blob-fix branch from 69e4b49 to a2043b1 Compare June 25, 2026 04:25
@wpfleger96 wpfleger96 merged commit e7c3638 into main Jun 25, 2026
2 checks passed
@wpfleger96 wpfleger96 deleted the duncan/keychain-blob-fix branch June 25, 2026 04:25
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