fix: validate before mutating secure backend in renameProfileAsync#217
Draft
bukinoshita wants to merge 1 commit intomainfrom
Draft
fix: validate before mutating secure backend in renameProfileAsync#217bukinoshita wants to merge 1 commit intomainfrom
bukinoshita wants to merge 1 commit intomainfrom
Conversation
Move all validation (no-op check, name validation, profile existence, destination collision) before any secure credential backend mutations. Previously, backend.set/delete ran before renameProfile() validation, causing two corruption modes: 1. Destination already exists: backend mutated, then renameProfile() throws, leaving credentials.json and secure storage out of sync. 2. Same-name rename: backend.set then backend.delete on same key deletes the stored secret, while renameProfile() returns early. The fix inlines the validation and file update from renameProfile() directly into renameProfileAsync(), so the backend is only touched after all preconditions pass. Resolves BU-629 Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Member
Author
|
@cubic-dev-ai can you review? |
Contributor
@bukinoshita I have started the AI code review. It will take a few minutes to complete. |
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.
Summary by cubic
Validate profile renames before touching the secure backend in
renameProfileAsyncto prevent corruption and keepcredentials.jsonin sync. Resolves Linear BU-629.Bug Fixes
newNameand ensurecredentials.jsonand source profile exist; reject if destination exists.get/set/delete) whenstorageissecure_storageand after all checks pass.credentials.jsonupdate, includingactive_profilewhen renamed.Tests
Written for commit 6a99fb2. Summary will update on new commits.