Skip to content

Conversation

gyaresu
Copy link

@gyaresu gyaresu commented Jun 27, 2025

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

@speatzle
Copy link
Collaborator

speatzle commented Jul 1, 2025

Hi, thanks for the PR, Currently there are some bigger changes inflight for supporting v5 encrypted metadata passbolt/go-passbolt#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants