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

Add 1Password 1PUX and Bitwarden JSON Importers #9815

Merged
merged 3 commits into from
Mar 9, 2024

Conversation

droidmonkey
Copy link
Member

@droidmonkey droidmonkey commented Sep 1, 2023

Add 1Password 1PUX and Bitwarden JSON Importers:

Also included some tangentially related changes while doing the Import Wizard work...

Minor changes to Group API to make it more explicit:

  • Include check for group as recycle bin directly into the Group::isRecycled() function
  • Return the original root group from Database::setRootGroup(...) to force memory management transfer

Fix Spacing of QGroupBox:

  • Previously our base style sheet added roughly 20px of margin to the top and bottom of all QGroupBox. This caused visual errors where that margin was not needed/desired.
  • Transferred padding to the specific layouts instead where it belongs.

Screenshots

image

image

image

image

Testing strategy

Tested on Windows and wrote unit tests

Type of change

  • ✅ New feature (change that adds functionality)
  • ✅ Refactor (significant modification to existing code)

@droidmonkey droidmonkey added this to the v2.8.0 milestone Sep 1, 2023
@droidmonkey droidmonkey changed the title Fix spacing of QGroupBox's Add 1Password 1PUX and Bitwarden JSON Importers Sep 1, 2023
@michaelk83
Copy link

michaelk83 commented Sep 1, 2023

  • If all the import options are files, then you can use a the same file selector for all of them, and detect the source type from the extension (+ header if available). Then the type selection from the 1st screenshot isn't needed.
  • The credentials are only needed after the database selection (and only if the db isn't already open), so can be on a separate step. It should reuse the existing new/open database widgets.
  • I would suggest, therefore, to leave only the file chooser and database selection on the 1st wizard page. You may indicate the import type after a file has been selected, but this only needs a simple label. On the next step, reuse the existing new/open database widgets if the database is not already open.
  • The existing database dropdown should default to the current database. Or you may add an explicit "Current Database (name)" radio button.
  • An alternative route might be to drop the 1st page entirely, and have two menu actions: Database > Import to New... and Database > Import to Current.... But this would lose the "Go Back" feature of the wizard:
    • Import to Current would immediately open the file chooser, and proceed with the import from there.
    • Import to New would open the usual New Database window. Once the empty database is created, it would automatically call Import to Current.

Since this is a large PR, I'll take this opportunity to remind you of #9701, #8480, #8591 (and #8983), just in case. Though I'm sure you already remember.

@droidmonkey
Copy link
Member Author

droidmonkey commented Sep 1, 2023

Thanks but I'm not going to make any of those changes. I'm done working on this and it works really well.

The credential fields are for the import file not the database. Some file types are encrypted.

@michaelk83
Copy link

It's your choice, of course, but IMO the 1st page is much more complicated than it needs to be. This is my preferred route:

I would suggest, therefore, to leave only the file chooser and database selection on the 1st wizard page. You may indicate the import type after a file has been selected, but this only needs a simple label.

In particular, the credentials seem completely out of place.

The credential fields are for the import file not the database. Some file types are encrypted.

Ah, I see. That is not clear at all from this UI. And in any case, I would still leave them to a separate wizard page, and only if they're needed.

The other thing is a just minor convenience, since importing to the current database is likely to be the 2nd most common selection:

The existing database dropdown should default to the current database. Or you may add an explicit "Current Database (name)" radio button.

This would reduce the number of clicks to select the current database from 3 to 1.

@michaelk83
Copy link

If you insist on leaving the credentials on the 1st page, to make it clearer you could move them right under the file selector, and group them together.

@droidmonkey
Copy link
Member Author

I might try the visibility of the fields again, last time I tested that the wizard dialog got all hokey. I am also playing in the constraints of a qt horror show.

@droidmonkey
Copy link
Member Author

droidmonkey commented Sep 27, 2023

@michaelk83 do you like this better?

image

image

image

Also the currently visible database (if unlocked) is default selected for the existing database.

@michaelk83
Copy link

michaelk83 commented Sep 28, 2023

Yeah, this is much better.

@droidmonkey droidmonkey force-pushed the feature/1pux-import branch 4 times, most recently from 530cd56 to 268fd85 Compare October 1, 2023 11:28
@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Attention: Patch coverage is 47.63285% with 542 lines in your changes are missing coverage. Please review.

Project coverage is 63.64%. Comparing base (0acb15d) to head (e96d34d).

Files Patch % Lines
src/gui/wizard/ImportWizardPageSelect.cpp 0.00% 160 Missing ⚠️
src/gui/wizard/ImportWizardPageReview.cpp 0.00% 123 Missing ⚠️
src/gui/csvImport/CsvImportWidget.cpp 0.00% 92 Missing ⚠️
src/gui/wizard/ImportWizard.cpp 0.00% 38 Missing ⚠️
src/gui/DatabaseTabWidget.cpp 15.00% 34 Missing ⚠️
src/format/BitwardenReader.cpp 86.73% 30 Missing ⚠️
src/gui/csvImport/CsvParserModel.cpp 0.00% 22 Missing ⚠️
src/format/OPUXReader.cpp 90.64% 19 Missing ⚠️
src/format/OpVaultReader.cpp 37.04% 17 Missing ⚠️
src/gui/DatabaseWidget.cpp 88.00% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9815      +/-   ##
===========================================
- Coverage    63.95%   63.64%   -0.31%     
===========================================
  Files          358      362       +4     
  Lines        43375    43954     +579     
===========================================
+ Hits         27737    27973     +236     
- Misses       15638    15981     +343     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danperezasensio
Copy link

Any update on this?

@droidmonkey
Copy link
Member Author

@phoerious I need a review

@uKL
Copy link

uKL commented Jan 28, 2024

Any updates on a review for this PR?

@Kriechi
Copy link

Kriechi commented Feb 3, 2024

The fix for #9577 works great fields with the same name overwriting them on multiple occurrences, but I think it's incomplete, as the same problem also occurs for attached files:

  • in 1Password, have an entry with 3 attachements who's file names are identical: foo.txt with three different file sizes
  • import the OPVault into KeePass
  • observe that the newly imported entry only has one attachment foo.txt

Does this flow through the same code path or is this an independent bug?

@droidmonkey
Copy link
Member Author

droidmonkey commented Feb 3, 2024

Different bug, easy fix, will get that in -- and all done.

@droidmonkey droidmonkey force-pushed the feature/1pux-import branch 4 times, most recently from 22c8ea8 to bbdb7b2 Compare March 8, 2024 13:44
Copy link
Member

@phoerious phoerious left a comment

Choose a reason for hiding this comment

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

Some minor things. Rest looks good.

src/format/BitwardenReader.cpp Show resolved Hide resolved
src/format/BitwardenReader.cpp Outdated Show resolved Hide resolved
src/format/OPUXReader.cpp Outdated Show resolved Hide resolved
src/format/OPUXReader.cpp Outdated Show resolved Hide resolved
src/gui/csvImport/CsvImportWidget.cpp Outdated Show resolved Hide resolved
src/format/BitwardenReader.cpp Show resolved Hide resolved
* Previously our base style sheet added roughly 20px of margin to the top and bottom of all QGroupBox. This caused visual errors where that margin was not needed/desired. 
* Transferred padding to the specific layouts instead where it belongs.
* Include check for group as recycle bin directly into the Group::isRecycled() function

* Return the original root group from Database::setRootGroup(...) to force memory management transfer
* Closes #7545 - Support 1Password 1PUX import format based on https://support.1password.com/1pux-format/

* Closes #8367 - Support Bitwarden JSON import format (both unencrypted and encrypted) based on https://bitwarden.com/help/encrypted-export/

* Fixes #9577 - OPVault import when fields have the same name or type

* Introduce the import wizard to handle all import tasks (CSV, KDBX1, OPVault, 1PUX, JSON)

* Clean up CSV parser code to make it much more efficient and easier to read

* Combine all importer tests (except CSV) into one test file
@droidmonkey droidmonkey merged commit e700195 into develop Mar 9, 2024
10 of 11 checks passed
@droidmonkey droidmonkey deleted the feature/1pux-import branch March 9, 2024 15:44
libf-de pushed a commit to libf-de/keepassxc-secretservice-dbus that referenced this pull request Mar 11, 2024
Release 2.7.7

- Support USB Hotplug for Hardware Key interface [keepassxreboot#10092]
- Support 1PUX and Bitwarden import [keepassxreboot#9815]
- Browser: Add support for PassKeys [keepassxreboot#8825, keepassxreboot#9987, keepassxreboot#10318]
- Build System: Move to vcpkg manifest mode [keepassxreboot#10088]

- Fix multiple TOTP issues [keepassxreboot#9874]
- Fix focus loss on save when the editor is not visible anymore [keepassxreboot#10075]
- Fix visual when removing entry from history [keepassxreboot#9947]
- Fix first entry is not selected when a search is performed [keepassxreboot#9868]
- Prevent scrollbars on entry drag/drop [keepassxreboot#9747]
- Prevent duplicate characters in "Also choose from" field of password generator  [keepassxreboot#9803]
- Security: Prevent byte-by-byte and attachment inference side channel attacks [keepassxreboot#10266]
- Browser: Fix raising Update Entry messagebox [keepassxreboot#9853]
- Browser: Fix bugs when returning credentials [keepassxreboot#9136]
- Browser: Fix crash on database open from browser [keepassxreboot#9939]
- Browser: Fix support for referenced URL fields [keepassxreboot#8788]
- MacOS: Fix crash when changing highlight/accent color [keepassxreboot#10348]
- MacOS: Fix TouchID appearing even though lid is closed [keepassxreboot#10092]
- Windows: Fix terminating KeePassXC processes with MSI installer [keepassxreboot#9822]
- FdoSecrets: Fix database merge crash when enabled [keepassxreboot#10136]

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEENIkEDB8MPuq41ValRA/GXy4MbgEFAmXs7VsACgkQRA/GXy4M
# bgHLpwf/brnyPPs3gJxZmD2pn8542D4CCsDh0fTceurOtqCe3J4Y+Fftc5euuoQu
# 6rP4vJdd586l7JX5FnYIPXvGiU9op3MudJh+y+RN/PWwKcXNIXfUItMhpZEka49n
# xnw+Wvbilg1QIHSSmZdIjBpohnEkA67qhWauc3bCacrRyEvIOzVMTxnqDTe4GUDy
# CyauaRMMKezRTpLxSsk63TDAZZgDwK4ci5lC6ysHekc1Za6IbI3fMFjz1BGj+kPU
# tMHMfDCWqK/5JZ27ZWcxy7m8tJY9m3rb+MoCyFRQz9ixaEe29yf5NqYdm9sn1Dlh
# O7aFi7/EJtsBlXdguw5BcTPbsL7XEQ==
# =Cots
# -----END PGP SIGNATURE-----
# gpg: directory '/home/runner/.gnupg' created
# gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
# gpg: Signature made Sat Mar  9 23:14:35 2024 UTC
# gpg:                using RSA key 3489040C1F0C3EEAB8D556A5440FC65F2E0C6E01
# gpg: Can't check signature: No public key
@dtgay
Copy link

dtgay commented Mar 16, 2024

@droidmonkey Thanks for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants