fix(desktop): prevent stale backup password encryption - #7229
Draft
tellaho wants to merge 1 commit into
Draft
Conversation
Invalidate in-flight onboarding backup encryption whenever the password changes so an earlier request cannot commit under a later displayed value. Cover the production timing sequence in reducer and delayed bridge tests. Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@buzz.block.builderlab.xyz> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
🔐 Codex Security Review
|
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.
Category: fix
User Impact: Editing a backup password while encryption is running now reliably saves the backup with the final password shown in Buzz.
Problem: On slower machines, onboarding could finish encrypting with an earlier password value after the user continued editing, leaving a valid backup that rejected the password they recorded.
Solution: Password edits now invalidate the active encryption generation, so stale completions are ignored and the final value is encrypted before the backup workflow advances.
File changes
desktop/src/features/onboarding/lib/encryptedBackup.ts
Invalidate the active encryption request whenever the password changes, reusing the existing request-ID fence to reject stale results.
desktop/src/features/onboarding/lib/encryptedBackup.test.mjs
Replace the synthetic two-request scenario with the production transition: edit during request one, queue the download, reject request one's completion, and keep the final password eligible for encryption.
desktop/tests/e2e/onboarding-backup.spec.ts
Add delayed bridge coverage that widens the slow-machine race window, inspects the passwords sent across the Tauri IPC seam, and verifies onboarding advances only after encrypting the final value.
Reproduction Steps
Validation
pnpm checkpnpm test— 5,880 tests passedpnpm build:e2epnpm exec playwright test tests/e2e/onboarding-backup.spec.ts tests/e2e/profile-backup-settings.spec.ts --project=smoke— 17 tests passedThe Playwright regression uses a 750 ms encryption delay to simulate the wider timing window seen on slower Windows machines. It is not native Windows execution; the repository's Windows build CI supplies platform-specific build coverage.