Skip to content

No way to give an entry or group its UUID and times, or an entry its history, when building a database #96

Description

@astrapi69

Version 2.2.4, KeePassJava2-jackson (the same holds for KeePassJava2-simple).

An application that keeps KeePass data in its own model and writes it back out cannot write back what it read: the entry's and group's UUID, the entry's four timestamps with the expiry flag, and the entry's history.

  • JacksonEntry declares protected UUID uuid, protected Times times, protected JacksonHistory history; JacksonGroup declares protected UUID uuid, protected Times times. There is no setter for any of them, and setExpiryTime/setExpires are the only time-related setters.
  • No factory takes them: JacksonDatabase.newEntry() and newGroup() are parameterless and assign a random UUID and the current time.
  • AbstractDatabase.newEntry(Entry) copies properties, binaries and icon, not UUID or times.
  • Subclassing does not help: JacksonEntry.database is package-private, so an entry built by a subclass has no database, and setProperty on it fails.
  • Every property or binary setter calls touch(), which stamps the modification time, so even with access to times it has to be written last.

The effect, measured with a database written by KeePassXC 2.7.10 and read back with keepassxc-cli export -f xml: after reading it and writing it again through newEntry/newGroup of the Simple model, every entry and group had a new UUID, all timestamps were the moment of the write, and the history was empty. The Jackson model offers the same API shape for these fields.

Would you accept setters (or a factory method taking these values) for UUID and Times on entries and groups, and for the history on entries? We reach the fields by reflection until then, in one class, and would switch to the API.

Context: mystic-crypt-ui, astrapi69/mystic-crypt-ui#382 and #384.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions