marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
201 stars 39 forks source link

[BUG]: bitwarden imports of organization vaults fail #623

Closed levma closed 4 months ago

levma commented 6 months ago

⚠️ This issue respects the following points: ⚠️

Server Information

Nextcloud v27.1.5
Passwords v2023.12.31

Client Information

Browser and Version: latest Chrome, latest Safari Client OS and Version: latest macOS

Bug description

Try to import a bitwarden json from an export of an organizations vault. It fails because the javascript tries to access an undefined object.

Steps to reproduce

  1. open passwords app in browser / nextcloud instance
  2. goto import
  3. choose bitwarden json
  4. select your organizations vault export file

Expected behavior

  1. import the bitwarden json file
  2. see all passwords in the passwords app
  3. my proposition: use the vaults collections as folders

Nextcloud Logs

unnecessary

Browser Logs

[Info] Passwords Info – "Passwords Import: Parsing input file" (app.js, line 2)
[Error] TypeError: undefined is not an object (evaluating 'e')
(anonyme Funktion) — ImportManager.d90792a2c1b05801e1b7.js:741
    (anonyme Funktion) (BackupSection.2c699d91dba4163a2847.js:1:31379)

This is https://github.com/marius-wieschollek/passwords/blob/d68396580209ac7a003065bba30aa4e8a4ffb061/src/js/Helper/Import/BitwardenConversionHelper.js#L38 trying to access `folders` which DO NOT exist in the json file.

Consider changing this line https://github.com/marius-wieschollek/passwords/blob/d68396580209ac7a003065bba30aa4e8a4ffb061/src/js/Helper/Import/BitwardenConversionHelper.js#L18C54-L18C66

to `let {tags, tagMap} = await this._processTags(data.folders || data.collections || []);`
levma commented 6 months ago

and probably on line https://github.com/marius-wieschollek/passwords/blob/d68396580209ac7a003065bba30aa4e8a4ffb061/src/js/Helper/Import/BitwardenConversionHelper.js#L109 consider to process the collectionIds array…

marius-wieschollek commented 6 months ago

I have added a patch to the nightly version that should be able to handle the collection ids