Narigo/keepass-diff

Does not work with KDBX 3.1 format

pludi opened this issue · 6 comments

pludi commented

What is happening

When comparing databases with at least 1 having a KDBX 3.1 DB format, keepass-diff apparently enters an infinite loop

What should happen

Output of the differences.

Steps to reproduce

  1. Create 2 databases, explicitly selecting KDBX 3.1 format
  2. Compare them using keepass-diff without any special options

Versions used

  • KeePassXC: 2.4.3
  • keepass-diff: 1.0.0
  • cargo/rustc: 1.41.0

Thanks for the report @pludi ! Could you create reproducer files for this?
This sounds like a limitation of the underlying keepass-rs dependency and it probably should be addressed there. Still, we might want to add a test for this scenario in here.

pludi commented

Had to gzip them to get past GitHubs filter.

Test1.kdbx.gz, Password: Test1
Test2.kdbx.gz, Password: Test2

Hmm, works for me but takes 5 minutes or so with RUSTFLAGS="-C target-cpu=native". From my debugging, it looks like it has a very high number of transformation_rounds in the headers of the files, so it runs the encryption very often. This needs to be addressed in keepass-rs, so I have opened issue 25.

@pludi maybe you want to re-check with version 1.0.1 now. It should have the rustflags set already. It's still slow but I could at least use it on your test files. I have added the test files to the tests as well now, to see that they can be opened.

pludi commented

Ran it after compiling with the optimization RUSTFLAGS you've posted:

time ~/git/personal/keepass-diff/target/release/keepass-diff --password-a Test1 --password-b Test2 Test1.kdbx Test2.kdbx
- [Root, Test1]
+ [Root, Test2]

~/git/personal/keepass-diff/target/release/keepass-diff --password-a Test1     5,61s user 0,00s system 99% cpu 5,610 total

Quite a lot better 👍

Okay, I will close this now, the tests run way better in the newest version, with the flags set in .cargo/config.toml.