sseemayer / keepass-rs

Rust KeePass database file parser for KDB, KDBX3 and KDBX4, with experimental support for KDBX4 writing.
https://docs.rs/keepass
MIT License
116 stars 39 forks source link

Not Pulling Some Data from KDBX4 File Versions #33

Closed jgrussell closed 1 year ago

jgrussell commented 3 years ago

Entry::AutoType.sequence is one example of data that is not being populated from KDBX4 files but is working fine with KDBX3 files.

I actually stumbled onto this issue attempting to pull ExpiryTime from the database for #29. My changes in xml_parse.rs seem to be working great with KDBX3 files but showing gibberish for this XML value in KDBX4.

Sadly, I do not yet have the rust skills address this myself. But, I am putting together a draft PR updating entry_tests.rs and test_db_kdbx4_with_password_aes.kdbx to illustrate the Entry::AutoType.sequence behavior.

sseemayer commented 3 years ago

Thanks for filing the issue! Probably, there is some difference in the XML formats betwen KDBX3 and KDBX4 that I was not yet aware of.

sseemayer commented 3 years ago

As a heads-up, I am in a state of being constantly very busy with my day job, so I might not be able to do much troubleshooting on this right now. It might take me some time to fix this.

keepass-rs was one of my first real Rust projects, and I learned a lot in writing it. If you want to take a stab at fixing this yourself, I do think that I would have enough time to mentor.

jgrussell commented 3 years ago

I think I have found my issue with pulling ExpiryTime from the database for #29 at the very bottom of the official KDBX 4 documentation page:

In encrypted KDBX 4 files (not in plaintext XML exports), all times are now stored as Base64 string of the Int64 number of seconds elapsed since 0001-01-01 00:00 UTC. This improves the performance and reduces the file size.

Note: The file formats look the same when saved/exported as unencrypted XML!

@sseemayer, I would love to take you up on the mentoring offer as your availability permits. I think I am getting close to having something presentable via a Draft PR for addressing #29 and will definitely appreciate any corrections, commentary, suggestions, etc. I have tried to follow your coding style for a few reasons:

Maybe I can track down the KDBX4 issue with Entry::AutoType.sequence after that.

Thank you again!

sseemayer commented 3 years ago

Sounds great, let's do it! 💪

regarding coding style in Rust, there is rustfmt. Just

  1. run rustfmt on the codebase before you do any work
  2. if there are changes, commit them separately
  3. do your changes in any coding style you like
  4. run rustfmt again
  5. commit
sseemayer commented 3 years ago

Regarding the issue itself, let's do #29 first and then follow up with this issue.