Fix issues with reloading and handling of externally modified db file #10612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on the discussion of issue #5290 and analyses, I've come to the following list of issues.
Some scenarios where a reload will not complete successfully.
There is code in place that is supposed to protect against this but it doesn't function as intended.
keepassxc/src/core/Database.cpp
Line 266 in 6f11422
keepassxc/src/core/FileWatcher.cpp
Line 107 in 6f11422
keepassxc/src/core/FileWatcher.cpp
Lines 119 to 125 in 6f11422
The current hash of the file is directly saved in
m_fileChecksum
upon detecting the change.The fail-safe check therefore only works as intended in the short window that the file was modified on disk but was not picked up by FileWatcher yet.
When keys of the db file have changed (password changed, YubiKey added/removed, ...). there should be a way to enter them.
This PR aims to address these issues.
Changes
In the case where the user has auto-reload disabled they will not see the "File changed - Want to reload?" dialog but can make a choice at the "Reload database" dialog (see screenshot).
Fixes #5290
Screenshots
Testing strategy
Added test-case to TestDatabase.
Manual testing.
Type of change