Repository navigation
[PM-46258] [Importer] Preserve displaced values on duplicate KeePass2 XML String keys - #24423
Conversation
…ed fields Clipperz marks locked fields with hidden: true; they were imported as plain-text custom fields or silently dropped. Multiple fields sharing an actionType (e.g. several locked password-type fields) overwrote each other unconditionally, so the last field won the slot and earlier values were lost. - hidden: true fields now import as hidden custom fields - the password slot prefers a field actually labeled as a password; a displaced or additional field becomes a hidden custom field instead of vanishing - the same no-silent-overwrite guard applies to username and url fields fixes #24365
Duplicate <String> elements with the same Key (produced by KeePass database merges and third-party exporters) silently overwrote earlier values: the last Password won the login slot and previous values were dropped entirely. Displaced values are now kept as custom fields (hidden for Password and otp), and duplicate URL keys append to the login's URI list instead of replacing it.
|
Thank you for your contribution! We've added this to our internal tracking system for review. Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process. |
|
Hi @arxhr007 and thanks for your first contribution to Bitwarden! It looks like this PR contains the same proposed changes as your earlier PR, if that's correct, would you mind closing that one? I'll begin reviewing this PR next, and will reach out here with any questions or concerns that arise. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24423 +/- ##
=======================================
Coverage 63.16% 63.17%
=======================================
Files 4989 4989
Lines 162529 162556 +27
Branches 26210 26221 +11
=======================================
+ Hits 102666 102692 +26
+ Misses 52890 52883 -7
- Partials 6973 6981 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@arxhr007 I've tested these changes against KeePass XML and Clipperz export files and this is a huge improvement. Imports behave exactly as you've described. I've sent the internal ticket corresponding to this PR to QA for a final review. |
🎟️ Tracking
Fixes #24365 (same overwrite class of bug, affecting Clipperz and KeePass XML).
https://bitwarden.atlassian.net/browse/PM-46258
https://bitwarden.atlassian.net/browse/PM-46162
📔 Objective
The KeePass2 XML importer silently dropped data on duplicate
<String>keys. KeePass databases merged through KeePass's own sync/merge, or produced by third-party exporters, can contain entries where the sameKeyappears more than once:The previous code assigned reserved keys (
URL,UserName,Password,otp,Title) unconditionally, so the last value won the cipher slot and every earlier value was lost entirely — not even preserved as a custom field.Changes:
Passwordandotpvalues are kept as hidden custom fields; displacedUserNameandTitlevalues as text fields. The value that wins the login slot is identical to current behavior.URLkeys now append to the login's URI list (Bitwarden supports multiple URIs per login) instead of replacing it.enpass-json-importer(isNullOrWhitespaceguard) andsafeincloud-xml-importer(secret candidates kept as hidden fields).📸 Testing
TestDataDuplicateKeysfixture plus 3 specs covering: displaced password preserved as hidden field, displaced username/title/otp preserved as fields, and duplicate URLs appended to the URI list.Note: I was unable to run the Jest suite locally (repo requires Node ≥ 24); the routing logic was verified with a distilled harness (15/15 cases). Relying on CI for the full suite.
⏰ Reminders before review