Database corruption
Description
My database has been corrupted a third time, and since I isolated the databases I'm sure it has to be KeePassium. I suspect it has to do with the setting Remember Selected Entries with autofill, but am not sure.
How to reproduce
Sadly, since I do not know exactly what is happening when and why, I can't give detailed instructions.
The only thing I can say is it started happening when the setting Remember Selected Entries was introduced and when it's enabled.
Expected behavior
Database shouldn't corrupt and instead saves normally.
Screenshots /
Environment:
- Device: iPhone SE 3 (iPhone 14,6)
- OS: iOS 18.7.1
- App Version: 2.5.171
Additional context
#481
The database is hosted on a private Nextcloud server, and I access it with KeePassium via WebDav.
Additional symptoms from #481 and email reports:
- This occurs after database is modified by AutoFill.
- In one case, changes were being saved by the app only (YubiKey-protected DB)
- In two cases, database became smaller.
- DB1 loads, but reports an attachment is missing ("Some entries refer to non-existent binaries [IDs: 0]"; 2 MB file turned into 39 KB).
- DB2 (#481) got truncated, so KeePassXC reports invalid inner header size.
- DB3 loads fine, but protected fields are mangled as if by a wrong text encoding (indicates corruption of the inner cipher key).
There are 3 reports so far, so this is clearly a bug. But it was undetected after weeks in beta, and even after the full rollout of v2.4, there are only 3 cases — so it seems to be caused by a rare combination of events, DB properties or usage patterns.
As we are trying to reproduce this, any additional input is welcome.
I haven't had it happen in a while, but yesterday it did again.
I opened the database to log in somewhere, selecting the right entry.
Very quickly afterwards I did the exact same, but noticed the database wouldn't open because there wasn't enough RAM. What often did the trick was going to the menu to select a database, which I did. I noticed the warning of unsaved changes and that they could only be applied when I open the main app.
Upon opening the database still in the same menu (to autofill), it didn't open anymore and the file size has shrunk from 4.1MB to 2.7MB again.
TL;DR, suspicious things are: low RAM and unsaved changes
OK, I did some more testing, and it almost consistently happens when logging into kagi.com. Remember Selected Entries is turned on.
It doesn't corrupt the database when Remember Selected Entries is turned off.