Rookiestyle / KeePassOTP

Add OTP support (two factor authentication) to KeePass
GNU General Public License v3.0
405 stars 29 forks source link

Database change every time it opens #130

Closed samuelyung closed 1 year ago

samuelyung commented 1 year ago

Hi, new user here. I'm not sure if I correctly setup this plugin or not, but every time I open the database this plugin will change it (but don't know where it changed). I can setup and generate TOTP for the entries, but even though I already saved the new changes, the next time I unlock the database it immediately got updated again.

How can I fix this problem?

Rookiestyle commented 1 year ago

How do you this plugin changes the database everytime you open it, did this behaviour start immediately after you installed it and did not happen before?

Which approach did you choose? https://github.com/Rookiestyle/KeePassOTP/wiki/KeePassOTP-storage-approaches

Do you have other plugins installed?

This should help me to analyze the issue you're facing.

samuelyung commented 1 year ago

Yes, this behavior starts immediately after I installed your plugin and it absolutely did not happen before. Now I must need to choose Discard Changes everytime I need to lock the database...

I store the TOTPs within the respective entry, don't use separate database.

I also use KeeAgent, KPEnhancedEntryView, and WebAutoType.

BTW here is the debug file in case this is useful: Debug_KeePassOTP_20230228T173417Z.zip

There is a translation file error and an OTP time correction error (that Japanese string means it can't setup SSL/TLS security channel), I guess they are not related to this issue, right?

Rookiestyle commented 1 year ago

This is the steps I did during my test

  1. Create a new database
  2. Setup some OTP within the respective entries
  3. Save db
  4. Close db
  5. Open db again
  6. Observer that DB is changed
  7. Close and confirm the "Save changes?" dialog with "Save"
  8. Open db again
  9. Close db
  10. DB is closed without any dialogs because it is not changed again

I assume steps 1 - 6 are the same for you but in step 7 you discard the changes? If that's the case, please try and save. This should solve the issue.

Reason behind: This okugin evovled over time and I'm checking for neccessary migrations from older plugin versions to the current one. To not do that over and over again, I need to store which migrations were already performed. Discarding the changes will prevent this informatiob to be stored which results in migration being done every time you open the db.

Please let me know whether following above steps solves the issue for you.

samuelyung commented 1 year ago

I don't understand that step 1... In order to use this plugin, I must need to create a new database whether I use OTP database or not?

Rookiestyle commented 1 year ago

No, this is only how I tested.

Please try the following:

  1. Open your existing db
  2. Close / Lock db
  3. Instead of "Discard changes", choose "Save changes"
  4. Reopen / Unlock
  5. Close / Lock db

Are you prompted to either discard or save again?

Rookiestyle commented 1 year ago

If you do Tools -> Database Tools -> Database Maintenance -> Plugin data you will see an entry named KeePassOTP.Migration.Status

This entry does not exist initially and is created the first time you open the database after you saved OTP data. If you save, this entry is saved and you should be fine.

samuelyung commented 1 year ago

Alright, it's fixed! Thanks a lot!