Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature : Update entries across groups when merging #807

Merged
merged 2 commits into from
Sep 5, 2017

Conversation

louib
Copy link
Member

@louib louib commented Jul 21, 2017

Summary of changes:

  • Find existing entries across the whole database when merging, using their UUID
  • Update existing entry location when merging
  • Added shallow option for cloning a group
  • Moved merge tests to their own test file.
  • Added qDebug statements when merging.

Description

Currently the merge functionality updates the entries by UUIDs, but only if they are in the same group. Moving an entry to another group would prevent that entry from updating, and would create a second entry with the same UUID in the database. This would cause other problems, like the duplicate entry not being written when saving.

This PR searches for entries using UUIDs across all the destination DB when merging.

I initially wanted to create a separate function for the synchronize feature (see #819). I don't think this is a good idea anymore. I think users will expect the merge functionality to detect identical entries and merge / update them. And if the databases are completely different, no UUIDs will match, so it will basically only be a merge.

One thing that I think is missing would be to detect entries using the title. I also think users will expect this when merging 2 databases that have identical / similar structure, but have been created differently (so the entries have different UUIDs). This is tricky though because there might be multiple entries with the same name, and some of those entries might even match with the UUID, so additional logic would need to be done for that. That would solve #818.

As the merge functionality gets more complex, we will add more unit tests for it, so I moved the merge tests to their own test file.

I added debug statements, because when I perform a merge/sync of my database (normally using the CLI), I want to have feedback on what was updated/created/moved.

Finally, I don't handle deleted entries and recycle bins yet, but I guess we should handle that in the future.

How has this been tested?

  • Existing unit tests are passing
  • Added new unit tests for entry relocation / updating.

Types of changes

  • ✅ Bug fix
  • ✅ New feature

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]
  • ✅ I have added tests to cover my changes.

@louib louib requested a review from a team July 21, 2017 19:31
@louib louib force-pushed the feature_merge_enhancement branch 4 times, most recently from 875d27a to 027fe8e Compare July 25, 2017 17:42
@louib louib force-pushed the feature_merge_enhancement branch 3 times, most recently from 3d45402 to 23ef0ab Compare August 5, 2017 14:32
@louib louib removed the needs work label Aug 5, 2017
@louib louib force-pushed the feature_merge_enhancement branch 3 times, most recently from 81cd9c6 to 4084639 Compare August 5, 2017 16:21
Copy link
Contributor

@TheZ3ro TheZ3ro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally will keep the MergeMode code since it's in the kdbx format.
At some point we should add that property to the Group window

@louib
Copy link
Member Author

louib commented Aug 20, 2017

@TheZ3ro after a quick look at the KeePass code, I believe the MergeMode is configured at the database level, and not at the group level. I'm not even sure it's stored in the kdbx file. It looks like there's an intermediate form when merging to select the merge mode for the current merge operation. I believe that makes more sense than setting the merge mode at the group level. Would keeping the merge mode but setting it at the database level be acceptable?

@louib louib force-pushed the feature_merge_enhancement branch 2 times, most recently from fc46f06 to 217b92b Compare August 30, 2017 20:15
@louib
Copy link
Member Author

louib commented Aug 30, 2017

@TheZ3ro I readded the MergeMode, I think we can address how to deal with it (Add the UI, move to the database level, etc) in another PR. There was a bug with the KeepBoth mode where the duplicated entry would use the same UUID as the old entry, with the same consequences as stated above. I fixed it and added unit test for it.

I think there is still a lot of work to do on the merge feature, but this is a path in the good direction I think. This PR is ready for a review.

Copy link
Contributor

@TheZ3ro TheZ3ro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems good. What about Group's UUID merge? I kind of like the qDebug reporting. Nice job.

@louib
Copy link
Member Author

louib commented Sep 5, 2017

@TheZ3ro I think we should also match groups using UUIDs, but this is going to change the behaviour of the functionality. We could add an option to fallback on entry title / group name matching in the future. What do you think?

@louib louib merged commit 1220b7d into keepassxreboot:develop Sep 5, 2017
@louib louib deleted the feature_merge_enhancement branch September 5, 2017 14:28
@TheZ3ro
Copy link
Contributor

TheZ3ro commented Sep 5, 2017

@louib it's ok I agree

@phoerious phoerious added this to the v2.3.0 milestone Oct 12, 2017
phoerious added a commit that referenced this pull request Feb 27, 2018
- Add support for KDBX 4.0, Argon2 and ChaCha20 [#148, #1179, #1230, #1494]
- Add SSH Agent feature [#1098, #1450, #1463]
- Add preview panel with details of the selected entry [#879, #1338]
- Add more and configurable columns to entry table and allow copying of values by double click [#1305]
- Add KeePassXC-Browser API as a replacement for KeePassHTTP [#608]
- Deprecate KeePassHTTP [#1392]
- Add support for Steam one-time passwords [#1206]
- Add support for multiple Auto-Type sequences for a single entry [#1390]
- Adjust YubiKey HMAC-SHA1 challenge-response key generation for KDBX 4.0 [#1060]
- Replace qHttp with cURL for website icon downloads [#1460]
- Remove lock file [#1231]
- Add option to create backup file before saving [#1385]
- Ask to save a generated password before closing the entry password generator [#1499]
- Resolve placeholders recursively [#1078]
- Add Auto-Type button to the toolbar [#1056]
- Improve window focus handling for Auto-Type dialogs [#1204, #1490]
- Auto-Type dialog and password generator can now be exited with ESC [#1252, #1412]
- Add optional dark tray icon [#1154]
- Add new "Unsafe saving" option to work around saving problems with file sync services [#1385]
- Add IBus support to AppImage and additional image formats to Windows builds [#1534, #1537]
- Add diceware password generator to CLI [#1406]
- Add --key-file option to CLI [#816, #824]
- Add DBus interface for opening and closing KeePassXC databases [#283]
- Add KDBX compression options to database settings [#1419]
- Discourage use of old fixed-length key files in favor of arbitrary files [#1326, #1327]
- Correct reference resolution in entry fields [#1486]
- Fix window state and recent databases not being remembered on exit [#1453]
- Correct history item generation when configuring TOTP for an entry [#1446]
- Correct multiple TOTP bugs [#1414]
- Automatic saving after every change is now a default [#279]
- Allow creation of new entries during search [#1398]
- Correct menu issues on macOS [#1335]
- Allow compilation on OpenBSD [#1328]
- Improve entry attachments view [#1139, #1298]
- Fix auto lock for Gnome and Xfce [#910, #1249]
- Don't remember key files in file dialogs when the setting is disabled [#1188]
- Improve database merging and conflict resolution [#807, #1165]
- Fix macOS pasteboard issues [#1202]
- Improve startup times on some platforms [#1205]
- Hide the notes field by default [#1124]
- Toggle main window by clicking tray icon with the middle mouse button [#992]
- Fix custom icons not copied over when databases are merged [#1008]
- Allow use of DEL key to delete entries [#914]
- Correct intermittent crash due to stale history items [#1527]
- Sanitize newline characters in title, username and URL fields [#1502]
- Reopen previously opened databases in correct order [#774]
- Use system's zxcvbn library if available [#701]
- Implement various i18n improvements [#690, #875, #1436]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants