keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
20.16k stars 1.42k forks source link

Document "Merge From Database" behavior #9143

Open adam-lab opened 1 year ago

adam-lab commented 1 year ago

Summary

I am seeking a good way to synchronize my password collection across multiple computers, and I think the "Merge from Database" tool (in the "Database" menu) may be useful. However, I cannot find any documentation for it, and have encountered unexpected behavior that could have resulted in loss of data if I hadn't noticed the missing records.

Examples

Proposal:

  1. Document 'Merge from Database' feature so that users know what behavior to expect and how it differs from other options (like dragging records between databases).
  2. Consider making the "Merge from Database" tool more verbose and require confirmation of actions that modify or delete existing records. The EndNote 'duplicates' tool could be a good example. At the least, the "Merge from Database" tool should report how many records it imported, how many it deleted, and how many it modified.
  3. Consider adding a 'merge duplicates' feature to eliminate the duplicated records that can result from merger.

Context

My specific use case is that I have been adding to a KeePass DB on my home computer over many years, and now I want to make a subset of those passwords available on other computers (e.g. my work computer or my spouse's computer). If I (or my spouse) update the password and record it on one of those computers, I want to be able to merge that information back into the database(s) on my home computer.

In my first attempt, I made a duplicate of my database, then deleted all the 'non work' passwords, and moved the new database to my work computer. Months later, having made updates to my 'work db', I tried to merge it back into my master database and it deleted a bunch of records. These seem to be the records that I deleted when I set up the work database. I then tested whether I could eliminate this problem by moving all the records from the work database to a new database, then using the new db as a source for merging. This ended up duplicated the records.

I think my current solution will be to split my database into three separate, non-overlapping databases: work, household (shared with spouse), and personal (everything else). I think this will work as long as there is no need to store any records in more than one database (e.g. I do not share any of my work accounts with my spouse).

I also considered moving each subset to a new database for sharing, then immediately merging back into the main database, then sharing the new database and merging any changes in the future. However, I'm not sure what behavior to expect from the 'merge' function, and it seems more complicated than just keeping separate databases.

droidmonkey commented 1 year ago

1152 captures a merge report and allowing to accept/reject changes

As an immediate response, merging is done at the ENTRY level. An entry is overwritten if it's UUID's match and the incoming entry has a newer modified datetime stamp. The original entry is pushed into history and can be reverted if needed.

When you delete entries, a record of that deletion (the entry UUID) is stored in the database to allow for successful merges and prevent entries from reappearing. That is why when you merged the database with deleted entries it deleted entries in the existing database. That is absolutely expected behavior.

akaihola commented 1 year ago

1152 captures a merge report and allowing to accept/reject changes

As an immediate response, merging is done at the ENTRY level. An entry is overwritten if it's UUID's match and the incoming entry has a newer modified datetime stamp. The original entry is pushed into history and can be reverted if needed.

When you delete entries, a record of that deletion (the entry UUID) is stored in the database to allow for successful merges and prevent entries from reappearing. That is why when you merged the database with deleted entries it deleted entries in the existing database. That is absolutely expected behavior.

Would indeed be great to have this information included in the documentation!

makeasnek commented 2 months ago

Found this github issue while trying to research this functionality. Would also like to see this in the docs. I will pay $10 in BTC (via BTC lightning) to anybody who writes the docs for this and gets them added to the site.