Skip to content

feat: add KeePass plugin for KDBX 4.0 database support#413

Open
QaDeS wants to merge 1 commit intodmno-dev:mainfrom
QaDeS:main
Open

feat: add KeePass plugin for KDBX 4.0 database support#413
QaDeS wants to merge 1 commit intodmno-dev:mainfrom
QaDeS:main

Conversation

@QaDeS
Copy link

@QaDeS QaDeS commented Mar 15, 2026

  • feat: add KeePass plugin for KDBX 4.0 database and KeePassXC CLI support

Adds @varlock/keepass-plugin with two modes: direct KDBX file reading via kdbxweb (production) and keepassxc-cli integration (development). Registers @initKeePass decorator, kp()/kpBulk() resolvers, and kdbxPassword data type.

  • feat: add argon2 support for KDBX 4.0, plugin README, root README update
  • Register argon2 implementation in kdbxweb CryptoEngine for KDBX 4.0 key derivation (kdbxweb does not bundle one)
  • Add argon2 as external dependency (native addon, not bundleable)
  • Add createRequire banner in tsup for kdbxweb's require("crypto")
  • Add comprehensive plugin README with usage examples
  • Update root README plugin count and table
  • fix: sanitize kpBulk keys into valid env var names

KeePass entry paths like "DB/itest" contain characters invalid in env var names. Sanitize by replacing non-alphanumeric chars with underscores and uppercasing. Non-default attributes (e.g. UserName) are appended as a suffix to avoid collisions between bulk loads of different attributes.

  • fixed spawnAsync to take an input option that gets streamed into the process stdin. Necessary for keepassxc-cli to work properly.

* feat: add KeePass plugin for KDBX 4.0 database and KeePassXC CLI support

Adds @varlock/keepass-plugin with two modes: direct KDBX file reading via
kdbxweb (production) and keepassxc-cli integration (development). Registers
@initKeePass decorator, kp()/kpBulk() resolvers, and kdbxPassword data type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add argon2 support for KDBX 4.0, plugin README, root README update

- Register argon2 implementation in kdbxweb CryptoEngine for KDBX 4.0
  key derivation (kdbxweb does not bundle one)
- Add argon2 as external dependency (native addon, not bundleable)
- Add createRequire banner in tsup for kdbxweb's require("crypto")
- Add comprehensive plugin README with usage examples
- Update root README plugin count and table

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: sanitize kpBulk keys into valid env var names

KeePass entry paths like "DB/itest" contain characters invalid in env
var names. Sanitize by replacing non-alphanumeric chars with underscores
and uppercasing. Non-default attributes (e.g. UserName) are appended as
a suffix to avoid collisions between bulk loads of different attributes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fixed spawnAsync to take an input option that gets streamed into the process stdin. Necessary for keepassxc-cli to work properly.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

⚠️ No Changeset found

Latest commit: 71bc0f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedkdbxweb@​2.1.18110010080100
Addedargon2@​0.44.010010010082100

View full report

@QaDeS
Copy link
Author

QaDeS commented Mar 15, 2026

Full test folder, with executable "test" script.

test-keepass-plugin.zip

Copy link
Member

@theoephraim theoephraim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Looks pretty good :)

Left a few small comments.

return;
}

// keepassxc-cli doesn't have a built-in batch mode, so we run individual `show` commands
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure I follow whats going on with the batching - we already parallelize resolutions so likely not necessary.

/**
* Find an entry by its path (e.g., "Group/SubGroup/EntryTitle").
*/
private findEntry(db: kdbxweb.Kdbx, entryPath: string): kdbxweb.KdbxEntry | undefined {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth doing a single pass putting everything into a hash with keys being the format used by the plugin? Make sure its only on the first actual read though, because we dont ever want to trigger an error if the plugin is not being used in the current resolution.

private dbPath?: string;
private password?: string;
private keyFile?: string;
private useDesktopApp?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be called useCli

}

// useDesktopApp (optional, static) - when true, uses keepassxc-cli instead of reading the file directly
if (objArgs.useDesktopApp && !objArgs.useDesktopApp.isStatic) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some options you dont necessarily need to make sure they are static. Like you could want to do something like useCli=forEnv(dev) to ensure it can only use for dev.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants