marius-wieschollek / passwords

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

BitwardenConversionHelper mixes tags and folders #468

Closed monperrus closed 2 years ago

monperrus commented 2 years ago

System Information

Server:

{
    "version": {
        "server": "23.0.0.10",
        "app": "2021.12.20",
        "lsr": false,
        "php": "8.0.14"
    },
    "environment": {
        "os": "Linux",
        "architecture": "x86_64",
        "bits": 64,
        "database": "sqlite3",
        "cron": "ajax",
        "proxy": false,
        "sslProxy": true,
        "subdirectory": false
    },
    "legacyApi": {
        "enabled": 0,
        "used": false
    },
    "services": {
        "images": "imagick",
        "favicons": "default",
        "previews": "default",
        "security": "hibp",
        "words": "random",
        "previewApi": false,
        "faviconApi": false
    },
    "settings": {
        "channel": "stable",
        "nightlies": false,
        "handbook": false,
        "performance": 5
    },
    "encryption": {
        "sse": {
            "SSEv1r1": false,
            "SSEv1r2": true,
            "SSEv2r1": false,
            "none": false,
            "default": "SSEv1r2"
        },
        "cse": {
            "CSEv1r1": false,
            "none": true,
            "default": "none"
        }
    }
}

Client:

 Browser and Version: Firefox 96

Steps to reproduce

  1. Export passwords from bitwarden to JSON file (https://vault.bitwarden.com/) >> Tools >> Export vault (Sample data below)
  2. Import with Bitwarden JSON import

Expected result

Folders are shown in tab "Folders"

Actual result

Folders are shown in tab "Tags"

Possible solution

Switch the import logic in BitwardenConversionHelper

  1. Folders are translated to Nextcloud Passwords folders
  2. Item types (field type in Bitwarden JSON) are translated to Nextcloud Passwords tags

Sample data

Sample export from Bitwarden

{
  "encrypted": false,
  "folders": [
    {
      "id": "28933aa6-1a98-497e-a3a2-ae0b008de389",
      "name": "testfolder"
    }
  ],
  "items": [
    {
      "id": "562346f2-7020-46f9-b496-ae0b008a7628",
      "organizationId": null,
      "folderId": null,
      "type": 1,
      "reprompt": 0,
      "name": "name",
      "notes": null,
      "favorite": false,
      "login": {
        "uris": [
          {
            "match": null,
            "uri": "https://foo.abar"
          }
        ],
        "username": "user",
        "password": "jkhkerzer",
        "totp": null
      },
      "collectionIds": null
    },
    {
      "id": "988147fe-294d-4d5b-b6fa-ae0b00a05431",
      "organizationId": null,
      "folderId": null,
      "type": 3,
      "reprompt": 0,
      "name": "sdfsdf",
      "notes": null,
      "favorite": false,
      "card": {
        "cardholderName": "qsdqsd",
        "brand": null,
        "number": "qsdqsd",
        "expMonth": null,
        "expYear": null,
        "code": null
      },
      "collectionIds": null
    },
    {
      "id": "beaacb29-8376-487d-9958-ae0b008dedc7",
      "organizationId": null,
      "folderId": "28933aa6-1a98-497e-a3a2-ae0b008de389",
      "type": 1,
      "reprompt": 0,
      "name": "sf",
      "notes": null,
      "favorite": false,
      "login": {
        "username": "sdf",
        "password": "sdfsdf",
        "totp": null
      },
      "collectionIds": null
    }
  ]
}
marius-wieschollek commented 2 years ago

This is the intended behavior of the import.

monperrus commented 2 years ago

Thanks @marius-wieschollek