go-passbolt-cli
go-passbolt-cli copied to clipboard
Adding folder structure to export for Keepass
Caveat: I am not a regular Go programmer and I provide this in hope that it provides some utility to folks.
PR: Add Folder Structure Support to Keepass Export
Description
This PR adds folder structure support to Keepass exports, maintaining the folder hierarchy from Passbolt when exporting to a Keepass (.kdbx) file. Previously, resources were exported to a flat structure.
Changes
- Added logic to retrieve folder information with nested resources and child folders
- Implemented recursive folder structure building
- Created an "Unfiled Resources" group for resources not in folders
- Added logging during export
- Updated resource handling to associate resources with folders
- Updated README with export instructions and examples
Features Supported
- Password resources with standard fields
- TOTP resources (both standalone and combined with passwords)
- Nested folder structures
Testing
Tested with:
- Nested folders with multiple levels
- Empty folders
- Resources in multiple folders
- Resources without folders
- TOTP and password resources
Compatibility
- Supports Passbolt v4 up to v5.2.0
- No support for Passbolt with encrypted metadata enabled
Hi, thanks for the PR, Currently there are some bigger changes inflight for supporting v5 encrypted metadata https://github.com/passbolt/go-passbolt/issues/23 . Due to those there will be some API changes which breaks a few things things around go-passbolt-cli including the Export. Because of that this PR will have to wait till that is finished.
In the meantime i took a quick look at the PR, here are some of the issues i found:
- Line breaks in front of output
- fetching Resources Twice
- Looping over folders to check which Resources aren't in folders when you could instead check if
resource.FolderParentID != ""on the Resources