Closed tepozoa closed 2 years ago
I need to investigate this more, group
is a list, as name
expect a string, this is why I used path
instead.
My Bitwarden export only has one folder, it's the "Secure Note" tree in Bitwarden - I don't use (sub)folders in "Login". I crafted an example JSON that has two Notes and two folderless logins (which I'm using for the other issue of de-duplication tests) which was causing "Notes" -> "Note" to happen in _find()
, it appears to be a string not a list in the debugger? Hope this helps!
Visually in BW:
Login:
github.com, bob
github.com, alice
Secure Note:
note_one, aaaa
note_two, bbbb
bitwarden_sample.json
{
"encrypted": false,
"folders": [
{
"id": "6b44243f-d960-47cb-a1e9-2c87b77d9a84",
"name": "Notes"
}
],
"items": [
{
"id": "008eee42-19f1-4d95-b8fb-37b2d86e895f",
"organizationId": null,
"folderId": "6b44243f-d960-47cb-a1e9-2c87b77d9a84",
"type": 2,
"reprompt": 0,
"name": "note_one",
"notes": "aaaa\n",
"favorite": false,
"secureNote": {
"type": 0
},
"collectionIds": null
},
{
"id": "8c4c35e6-4716-4448-bcb3-c117898daba6",
"organizationId": null,
"folderId": "6b44243f-d960-47cb-a1e9-2c87b77d9a84",
"type": 2,
"reprompt": 0,
"name": "note_two",
"notes": "bbbb\n",
"favorite": false,
"secureNote": {
"type": 0
},
"collectionIds": null
},
{
"id": "1565b318-baa5-4c20-92e9-af9a4626fd93",
"organizationId": null,
"folderId": null,
"type": 1,
"reprompt": 0,
"name": "github.com",
"notes": null,
"favorite": false,
"login": {
"uris": [
{
"match": null,
"uri": "https://github.com/"
}
],
"username": "bob",
"password": "hunter2",
"totp": null
},
"collectionIds": null
},
{
"id": "236f1d7b-02cf-474a-8990-8be7a458831c",
"organizationId": null,
"folderId": null,
"type": 1,
"reprompt": 0,
"name": "github.com",
"notes": null,
"favorite": false,
"login": {
"uris": [
{
"match": null,
"uri": "https://github.com/"
}
],
"username": "alice",
"password": "p@ssw0rd",
"totp": null
},
"collectionIds": null
}
]
}
Import command used, where sample.kdbx
is a fresh/empty KeepassXC DB file using defaults (KDBX 4 format):
pimport --force keepassxc bitwarden bitwarden_sample.json -o sample.kdbx
Agreed on the latest comments and new issue, I'm going to close this in favor of a proper solution once it's figured out.
The pykeepass README shows the proper usage; the way it's being used right now leads to "group" being None and "path" getting stripped of it's rightmost character, e.g. "Notes" -> "Note" in the internal
_find()
method in pykeepass.py:group_path = path[:-1]
; causing no groups to actually get found so a new one is added for every loop. Your KDBX file ends up with a new group for every item that's supposed to be in the same single group with the passed in item - using the documented method, groups are properly found if they exist.