-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attached images in entry lost #3048
Comments
Are you using any other program to access your database? |
On iPhone, I use Keepass Touch. On Windows, I use KeePass 2.41 |
Losing attachments is a big deal, we take any type of data loss seriously. I would not read too much into the total size of your database, KeePass databases employ compression before being encrypted so it could very well be the compression engine doing its job. I am hesitant to point my finger elsewhere for this issue, but you are using three different password manager applications. I use KeePassXC and KeePass2Android and have never lost an attachment. Please do the following to confirm the extent of the damage (on the broken db):
I am trying to see if there are any patterns. Do all of your attachments have the same file name? |
Please try to replicate this issue on a test database that is NOT opened by other programs (ie, only use KeePassXC). Your problem leads me to believe one of the other programs is not writing the data for the file on saving. Are you using KDBX4? |
Hello.
Yes, I do. First, I've tried to restore the database by synchronizing the latest corrupted version and outdated backup. Nither broken>backup nor backup>broken synchronization works: empty files remain empty. Then I tried to reproduce the problem on a scratch database but failed to get the same result. Maybe, you have any ideas on how to reproduce the error? |
I am wondering if the attachments are being blown away during a merge operation that occurs. Try leaving the database unlocked on your macOS, modify the database on Windows or on iPhone, then watch when the database reloads and merges into the one on macOS. Try looking into an entry's history to see if a previous copy of the entry is pointing to the intact attachment. |
Ok, I've reproduced the problem on a clean database using some of the private attachments, I had in my database. I've tried to mess up the database by editing it in KeePassXS/KeePass/KeePass touch, and I succeeded somehow, but not sure that I can do it once more. Nevertheless now I have KDBX that has non-empty attachment in KeePass 2.4.1 but it's empty in KeePassXS Use password |
I suspect that this problem is due to KeePass Touch. Sometimes it shows error dialog that there's problem when syncing my DB file due to my network is connected/disconnected. Perhaps during the sync process, it messes up my DB file. I've been using KyPass (iPhone) for 3 weeks now and this problem hasn't occured at all (my network is still the same, up/down a lot since I move around a lot). @SilverFire you should give KyPass a try |
On KeePass Touch's app page it lists the last fix as addressing:
Which is very ambiguous, but seems like they have issues... |
Thanks, I will!
The fix is a few months old, but yes, I suspect KeePass Touch is guilty. The KDBX I've provided in my previous post contains uncorrupted files on Windows KeePass 2.4.1 and KeePass Touch, however, KeePassXC shows |
Yes I'll run in through the debugger |
OK so here is the problem I observed:
My Opinion: @lbkvu did you save your database in KeePass Touch many many times? |
This should be easy to replicate if you just make 4 saves to the database in KeePass Touch then all the attachments should be 0 bytes (if my hunch is correct) |
I tried to edit "Attach from Wndows KeePass" record 4 times from KeePass Touch, but it seems that nothing changed: still one corrupted file |
I tried to reproduce everything from scratch:
Still no luck :( I'm not sure how I managed to mess it up previously. |
@droidmonkey I am still curious why KeePass on Windows shows |
OK so I found the issue... some program is adding a duplicate binary data (win_attach.txt) which is against the new kdbx4 standard. When this happens, KeePassXC discards the duplicate binary, however the entry still points to attachment 4 which now does not exist in our internal representation of the attachment data. This is both a failure of the KDBX4 standard (it should be using UUID or SHA256 hashes to identify attachments, not index values) and the program that is duplicating the binary attachment. To fix this issue we would have to ignore duplicate attachment binaries, which could result in databases growing in size unnecessarily. |
We should build a map that maps indices to hashes and then use the hashes internally to refer to files. That way we can "correct" erroneous index pointers by mapping them to the same hash, which then points (hopefully) to the correct file. This would automatically fix issues like this when the file is saved eventually. |
Thank you for the investigation. In there anything else I could do to help you fix the problem? |
We still need to figure out what triggers this situation. I am starting to think this is happening in keepass itself! |
* Fixes #3048 * Certain programs that read/write KDBX4 files do not consolidate duplicate attachments into a single binary. This is against the KDBX4 specification. This change ensures KeePassXC will at least read the database in its entirety and not lose information. Upon saving the database in KeePassXC, the duplicate attachment binaries will be reduced to single binaries per the specification.
Thank you for the response and prompt fix. |
We do but they are for develop branch. What OS are you running? |
Mojave 10.14.5 |
Here is a build I made, it is unsigned so install it "side-by-side" with your existing KeePassXC install: https://s3.amazonaws.com/droidmonkey-keepassxc/snapshots/KeePassXC-2.4.2-snapshot.dmg |
Sorry for a late reply. My original database with corrupted files still remains corrupted, adding new dumb record and saving does not fix old corruptions. However, the sample database I've made for this issue works well: previously missing files are available. I opened the latest healthy (but outdated) database and merged a corrupted one into the old. The newer changes got imported and the files remain available, so I think the problem is fixed. |
I have a similar problem, I attach a .txt file with original keepass in win10. |
I always capture the QR code for 2FA and save it in the entry as backup. However, when I check the attachment, its size becomes 0B.
Expected Behavior
Here's from my previous backup of the database
Current Behavior
Difference in image size
Normal state
Current state
Possible Solution, but broken
I use my backup database as the base database, then merge my current database into it. However, some attachment are still lost. The database file size becomes smaller than before.
Before merging
After merging
Steps to Reproduce
Context
Debug Info
KeePassXC - Version 2.4.1
Revision: 7bafe65
Qt 5.12.2
Debugging mode is disabled.
Operating system: macOS Mojave (10.14)
CPU architecture: x86_64
Kernel: darwin 18.0.0
Enabled extensions:
Cryptographic libraries:
libgcrypt 1.8.4
The text was updated successfully, but these errors were encountered: