Fix "Invalid folder" error when client sends empty folderId string#6967
Open
mango766 wants to merge 1 commit intodani-garcia:mainfrom
Open
Fix "Invalid folder" error when client sends empty folderId string#6967mango766 wants to merge 1 commit intodani-garcia:mainfrom
mango766 wants to merge 1 commit intodani-garcia:mainfrom
Conversation
Newer Bitwarden client versions (e.g. browser extension v2026.2.0) send folderId as "" (empty string) instead of null when "No folder" is selected. This causes the folder validation to attempt a database lookup with an empty string, which fails with "Invalid folder" and prevents saving the cipher. Normalize empty folderId to None at all three validation points: - update_cipher_from_data (create/update cipher) - put_cipher_partial (update cipher details) - move_cipher_selected (move ciphers to folder) Fixes dani-garcia#6962
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.
Newer Bitwarden client versions (browser extension v2026.2.0+) send
folderId: ""instead offolderId: nullwhen "No folder" is selected. This causes the folder validation atciphers.rs:451to attempt a database lookup with an empty string, which naturally fails and returns "Invalid folder" — preventing users from saving credentials entirely.As identified by @stefan0xC in the issue thread, this is because the
Option<FolderId>deserialization treats""asSome(FolderId(""))rather thanNone, so the validation code tries to look up a folder with an empty UUID.This PR normalizes empty
folderIdvalues toNoneat all three places where folder validation occurs:update_cipher_from_data(create/update cipher)put_cipher_partial(update cipher details)move_cipher_selected(move ciphers to folder)The normalization uses
Option::filterto convertSome(FolderId(""))→Nonebefore validation, and the normalized value is also passed tomove_to_folderso the downstream logic is consistent.Fixes #6962