Skip to content

Commit

Permalink
Fix cross-signing/SSSS reset
Browse files Browse the repository at this point in the history
We re-used the old SSSS key even when resetting, meaning we prompted
the user to create a new passphrase but then ignored it and kept using
the old one.

Fixes element-hq/element-web#13212
  • Loading branch information
dbkr committed Apr 16, 2020
1 parent 919189d commit 12f4690
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,12 @@ Crypto.prototype.bootstrapSecretStorage = async function({

await resetCrossSigning();

if (!oldKeyInfo || oldKeyInfo.algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {
// if we already have a usable default SSSS key, just use it.
if (setupNewSecretStorage || !oldKeyInfo || oldKeyInfo.algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {
// if we already have a usable default SSSS key and aren't resetting SSSS just use it.
// otherwise, create a new one
// Note: we leave the old SSSS key in place: there could be other secrets using it, in theory.
// We could move them to the new key but a) that would mean we'd need to prompt for the old
// passphrase, and b) it's not clear that would be the right thing to do anyway.
const { keyInfo, privateKey } = await createSecretStorageKey();
newKeyId = await createSSSS(keyInfo, privateKey);
}
Expand Down

0 comments on commit 12f4690

Please sign in to comment.