-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Avoid key prompts when resetting crypto #4586
Conversation
Attempting to get the backup key out of secret storage can cause the user to be prompted for their key, which is not helpful if this is being done as part of a reset. This check was redundant anyway and we can just overwrite the key with the same value. Also fix docs and remove check for active backup.
AIUI this fixes a regression introduced in #4542? Could we get them combined in the changelog? |
if (backupKeyFromStorage !== backupKeyBase64) { | ||
await this.secretStorage.store("m.megolm_backup.v1", backupKeyBase64); | ||
} | ||
await this.secretStorage.store("m.megolm_backup.v1", backupKeyBase64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation on this method says "... and we have secret storage active ..." - is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, doesn't look like there's a way to determine if we have 4s set up, afaics, so I guess I'll just remove that bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is this.secretStorageHasAESKey()
which is what resetKeyBackup
does, but given this is only called from bootstrapSecretStorage
, I don't think there's any need to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit alarmed by the fact we can change this stuff without any tests breaking. Is this behaviour actually tested at all?
I don't think we have a way of doing that automatically, but we could annotate it and flag it for does the release, although as far as what will do in the changelog, I don't believe it would be any different?
Behaviour that specific didn't have its own tests, no. |
It's a bit of a hobbyhorse of mine, but ideally a changelog would list all the PRs that contributed to making a particular change. In other words, if it takes a few PRs to land the complete feature and shake out the bugs, they all get listed and linked under one entry in the changelog, rather than dotted throughout the changelog. The Synapse changelog does quite a good job of this, for example: |
Ah, I see. Unfortunately I don't think that's a thing supported by https://github.com/t3chguy/release-drafter as far as I can see. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Attempting to get the backup key out of secret storage can cause the user to be prompted for their key, which is not helpful if this is being done as part of a reset. This check was redundant anyway and we can just overwrite the key with the same value.
Also fix docs and remove check for active backup.
Checklist
public
/exported
symbols have accurate TSDoc documentation.