Skip to content

Desktop: handle denied Keychain access during safeStorage decrypt without crash-report path#16

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-decryption-error-safestorage
Draft

Desktop: handle denied Keychain access during safeStorage decrypt without crash-report path#16
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-decryption-error-safestorage

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 15, 2026

Startup could fail with safeStorage.decryptString (“Decryption is not available”) when macOS Keychain access is denied at launch. This path currently surfaces as a crash report instead of a targeted user-facing recovery message.

  • Keychain-denied error classification

    • Added a dedicated KeychainAccessDeniedError in desktop/src/app.ts.
    • Wrapped safeStorage.encryptString/decryptString calls with a small classifier that maps keychain-unavailable conditions to this explicit error type.
  • Startup failure handling

    • Updated initApp startup error handling to intercept KeychainAccessDeniedError.
    • Shows a focused dialog (Keychain access is required) with actionable guidance (allow HomeCloud in system keychain/security settings, then restart), then exits cleanly.
    • Avoids routing this expected-denial case through the generic crash-report dialog.
  • Security/identity behavior preserved

    • No plaintext key fallback.
    • No automatic secret/keypair regeneration on decrypt failure (prevents silent identity/fingerprint churn).
try {
  await startApp();
} catch (error) {
  if (error instanceof KeychainAccessDeniedError) {
    dialog.showMessageBoxSync({
      type: 'error',
      title: app.getName(),
      message: 'Keychain access is required',
      detail: error.message,
      buttons: ['OK'],
    });
    app.quit();
    return;
  }
  showCrashDialogAndQuit(error instanceof Error ? error : new Error(String(error)));
}

Copilot AI changed the title [WIP] Fix crash report error while decrypting ciphertext in safeStorage Desktop: handle denied Keychain access during safeStorage decrypt without crash-report path Apr 15, 2026
Copilot AI requested a review from asrient April 15, 2026 13:11
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.

[Desktop] Crash Report: Error while decrypting the ciphertext provided to safeStorage.decryptString. Decryption is not available.

2 participants