keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.39k stars 1.48k forks source link

If entry has custom data it is set to modified state when pressing OK #11352

Open varjolintu opened 1 month ago

varjolintu commented 1 month ago

Overview

If an entry has custom data and it is edited, pressing OK without changing anything will trigger CustomData::updateLastModified() and the entry will be set as modified even if no data has been changed.

In this case the call stack shows:

Database::markAsModified() Database.cpp:957
ModifiableObject::emitModified() ModifiableObject.cpp:63
CustomData::copyDataFrom(const CustomData *) CustomData.cpp:155
EditEntryWidget::updateEntryData(Entry *) const EditEntryWidget.cpp:1217
EditEntryWidget::commitEntry() EditEntryWidget.cpp:1184
EditEntryWidget::acceptEntry() EditEntryWidget.cpp:1205
main main.cpp:218

Regression from https://github.com/keepassxreboot/keepassxc/commit/e4eee897f9fb931d8081f9b70da0b0f1e6a8b9b8

Steps to Reproduce

  1. Have an entry with Custom Data (e.g. Browser Integration has set allow/deny rule).
  2. Edit entry.
  3. Press Ok without changing anything -> entry state changes to modified.

Expected Behavior

If nothing has been changed, do not change the entry state. Maybe CustomData::copyDataFrom() shouldn't change the last modified value?

Actual Behavior

Entry is set to modified state.

KeePassXC - Version 2.8.0-snapshot (current develop branch) Revision: d57d167

Operating System: macOS

droidmonkey commented 1 month ago

This is likely the cause of https://github.com/keepassxreboot/keepassxc/issues/11345

varjolintu commented 1 month ago

Just having a note in the entry does not trigger this. Custom data is needed.

droidmonkey commented 1 month ago

The note is a distraction, has nothing to do with the issue

droidmonkey commented 1 month ago

Nevermind these two issues are completely unrelated