trustcrypto / OnlyKey-Firmware

The OnlyKey Firmware runs on the OnlyKey itself and provides the core functionality of OnlyKey.
https://docs.crp.to/firmware.html
212 stars 40 forks source link

Restore Backup does not change 'Return after Password' setting in slot #158

Closed rouzier closed 1 year ago

rouzier commented 1 year ago

I updated a password and removed the 'Return after Password' from my primary key in a slot. I then updated my backup key with the backup of my primary key. When testing my backup, I noticed that the backup still had the 'Return after Password' on that slot. My expected behavior is the slot should have removed the Return after Password setting on the backup slot.

Thank you

onlykey commented 1 year ago

Backups will be restored or overwrite the data on your key. They don't delete data though so for example if you had a backup with Slot 1 data and your key has Slot 2 data. Restoring that backup would not wipe the data in Slot 2 as doing that could cause a user to experience unrecoverable data loss.

rouzier commented 1 year ago

Yes, I understand that. However, I would expect I select None for 'Re-enter Password' that would transfer over to the slot after restoring. Which seems to be not the case.

onlykey commented 1 year ago

@rouzier I'm not sure what you mean here.

rouzier commented 1 year ago

Sorry, I was unclear. I attached a screenshot. Hopefully, that would help clear up any confusion. When I select None in 'Re-enter Password' Section, that does not overwrite the previous 'Return After Password' after doing a restore. image

onlykey commented 1 year ago

@rouzier This sounds like not related to backup/restore. I just set up a slot with return after password, I then submit the slot configuration the same as you have shown above, the result is that the return after password is removed and just the password is typed.

rouzier commented 1 year ago

Sorry for getting back to you late on this.

Here are my steps to replicate this.

I have two keys on firmware 3.0.4.

My primary and backup keys have the same configuration (I created my backup key from a restore).

They both have the password in slot 1, 'return after password' enabled.

I set the 'return after password' to None on my primary key, then make a backup.

I use the backup of my primary key to update my backup key.

After updating my backup key, the password on slot 1 still has 'return after password' enabled.

I would expect slot 1 on both keys to have the same behavior after I restore it from a backup.

onlykey commented 1 year ago

@rouzier This is expected. Backups store the data from the source device and when restoring write that data to the destination device. A restore does not wipe slot data though, so for example if you wipe the password on source device, do a backup, and restore to a different device that will not wipe the existing password on destination device. Doing that could cause users to unintentionally wipe data on their devices and lose access to accounts so restore only overwrites settings it does not wipe settings.

rouzier commented 1 year ago

Ok, I would need to wipe the backup key first before applying the restore to get the exact copy

onlykey commented 1 year ago

@rouzier Yes, that would do it.