keepassxreboot / keepassxc

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

Deleting Groups with active KeeShare sync configuration and recreate of them, deletes all entries in the original db #7300

Open mgeramb opened 2 years ago

mgeramb commented 2 years ago

Steps to reproduce:

Current Result: The "Test" entry will not be shown in the Group "Sync Shared" If you open the DB "Shared.kdbx" the "Test" entry is also missing there.

Expected Result: The "Test" entry should be shown in the group "Sync Shared" and in the "Shared" database

droidmonkey commented 2 years ago

This is the exact issue described in #6477

mgeramb commented 2 years ago

@droidmonkey : I'am not sure if this is exactly the same issue descripted in https://github.com/keepassxreboot/keepassxc/issues/6477, Maybe the technical reason in the background is the same, but I not read anything about deleting the whole shared group. This was the reason for me to provide this information. If you know that this has the same technical background, you can close this issue.

My comment in https://github.com/keepassxreboot/keepassxc/issues/6477 is another one. This is only related to the current 2.7 beta version and it seems that it has an other technical reason.

droidmonkey commented 2 years ago

Yes it's the same technical reason, but your description and recreate steps are really good. The reason any of this happens is because when you delete an object from your database, a deleted object uuid is stored forever in the kdbx backend for merging purposes. The problem arises with keyshare because you reintroduce an entry with the same uuid as the one you deleted, the merge algorithm says it needs to be deleted.

The fix I have in the pipeline is to give entries new uuids if they are moved outside the share group. Basically treat the share group as an internal database. Right now the databases essentially get flattened into each other which causes these problems.