Skip to content

Fix history items losing entry CustomData - #13573

Open
eric-lemesre wants to merge 2 commits into
keepassxreboot:developfrom
eric-lemesre:fix/history-item-customdata
Open

Fix history items losing entry CustomData#13573
eric-lemesre wants to merge 2 commits into
keepassxreboot:developfrom
eric-lemesre:fix/history-item-customdata

Conversation

@eric-lemesre

Copy link
Copy Markdown

Entry::beginUpdate() copies attributes, attachments and auto-type associations into the temporary history item, but not CustomData — unlike clone() and copyDataFrom(), which both copy it. As a result, every history item is created with empty CustomData, and restoring an entry from history wipes the entry's CustomData, silently losing KeePassXC-Browser settings and any other client metadata stored there.

This PR copies CustomData into the history item like the other components.

One known limitation we would like your opinion on: history items created before this fix have no CustomData, so restoring from those older items will still clear the entry's CustomData. We did not find a safe way to repair existing history retroactively.

Testing strategy

  • New unit test TestEntry::testHistoryItemCustomData covering both history item creation (CustomData carried over) and restore (CustomData restored).
  • Locally ran testentry, testmodified, testgroup, testkdbx2/3/4, testmerge, testcli, testbrowser — all passing. KeePass2Writer already scans history items' CustomData for KDBX version selection, so no additional format version bump is introduced by this change.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

AI usage disclosure

Per the contribution guidelines: development was done with Claude Code (model: Claude Fable 5, Anthropic); an additional critical code review pass was performed with Kimi-k3. All changes were reviewed, built and tested locally by the submitter.


We tried to keep this fix as small and focused as possible. If there are any changes you would like, or points we may have missed — particularly around merge/sync behaviour or the retroactive-history limitation — we would be glad to address them.

🤖 Generated with Claude Code

Entry::beginUpdate() copied attributes, attachments and auto-type
associations into the temporary history item but not CustomData, unlike
clone() and copyDataFrom(). As a result every history item was created
with empty CustomData, and restoring an entry from history wiped its
CustomData, losing KeePassXC-Browser settings and other client metadata.

Copy CustomData into the history item like the other components and add
TestEntry::testHistoryItemCustomData covering creation and restore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@droidmonkey droidmonkey added high priority 🚨 pr: bugfix Pull request fixes a bug labels Aug 6, 2026
@droidmonkey droidmonkey added this to the v2.8.0 milestone Aug 6, 2026
@varjolintu varjolintu added the pr: ai-assisted Pull request contains significant contributions by generative AI label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority 🚨 pr: ai-assisted Pull request contains significant contributions by generative AI pr: bugfix Pull request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants