Skip to content

KeePass export: mirror folder hierarchy, TOTP for KeePass 2, hardening - #139

Closed
devbytexx wants to merge 2 commits into
passbolt:mainfrom
devbytexx:feature/keepass-folder-groups
Closed

KeePass export: mirror folder hierarchy, TOTP for KeePass 2, hardening#139
devbytexx wants to merge 2 commits into
passbolt:mainfrom
devbytexx:feature/keepass-folder-groups

Conversation

@devbytexx

Copy link
Copy Markdown

Rework passbolt export keepass (fixes #57, #138, implements #75):

  • Mirror the Passbolt folder tree as nested KeePass groups. Folders are matched by ID (sibling names are not unique), folders whose parent is not shared attach to the top group, cyclic parent data cannot hang the export. Folderless resources stay in the top group.
  • New --folder flag: export only the given folder and its subfolders; resources outside the subtree are not decrypted at all.
  • New --comments flag: append Passbolt comment threads to the Notes field.
  • Write TOTP in both conventions: otpauth "otp" field (KeePassXC, KeeOtp2) and native TimeOtp-* fields for KeePass 2.x built-in generator.
  • Carry over tags, creation/modification timestamps and expiry dates.
  • Harden KDF settings to KeePass 2.x defaults (600k AES-KDF rounds for KDBX 3.1, 64 MiB Argon2 memory for KDBX 4); the library defaults triggered the KeePass "weak key transformation settings" warning.
  • Reject empty export passwords instead of writing an unprotected kdbx; mask interactive password input with '*' and confirm new passwords.
  • Skip resources without a secret instead of panicking; write to a temp file and rename on success so failed exports leave no partial kdbx.

Verified by unit tests and an integration test that decodes the produced kdbx (new kdbxcheck testscript command) and asserts group placement and TimeOtp fields against a live Passbolt container.

Rework `passbolt export keepass` (fixes passbolt#57, passbolt#138, implements passbolt#75):

- Mirror the Passbolt folder tree as nested KeePass groups. Folders are
  matched by ID (sibling names are not unique), folders whose parent is
  not shared attach to the top group, cyclic parent data cannot hang the
  export. Folderless resources stay in the top group.
- New --folder flag: export only the given folder and its subfolders;
  resources outside the subtree are not decrypted at all.
- New --comments flag: append Passbolt comment threads to the Notes field.
- Write TOTP in both conventions: otpauth "otp" field (KeePassXC, KeeOtp2)
  and native TimeOtp-* fields for KeePass 2.x built-in generator.
- Carry over tags, creation/modification timestamps and expiry dates.
- Harden KDF settings to KeePass 2.x defaults (600k AES-KDF rounds for
  KDBX 3.1, 64 MiB Argon2 memory for KDBX 4); the library defaults
  triggered the KeePass "weak key transformation settings" warning.
- Reject empty export passwords instead of writing an unprotected kdbx;
  mask interactive password input with '*' and confirm new passwords.
- Skip resources without a secret instead of panicking; write to a temp
  file and rename on success so failed exports leave no partial kdbx.

Verified by unit tests and an integration test that decodes the produced
kdbx (new kdbxcheck testscript command) and asserts group placement and
TimeOtp fields against a live Passbolt container.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Sep 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@devbytexx

Copy link
Copy Markdown
Author

Prebuilt packages for testing are available here:
https://github.com/devbytexx/go-passbolt-cli/releases/tag/v0.5.2-keepass-folders.1

The prerelease contains .deb/.rpm (amd64 + arm64), Windows zips, Linux/macOS tarballs, SHA-256 checksums and the generated command reference. Feedback welcome — especially from those affected by #57, #138 and #75.

@devbytexx

Copy link
Copy Markdown
Author

recheck

@cedricherzog-passbolt

Copy link
Copy Markdown
Contributor

Thanks for you contribution.

We already have a pull request opened for that #73 and an internal ticket (PB-50568) for the implementation.
We will send updates on #57.

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.

Export keepass could also export folder hierarchy

3 participants