You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Don't handle key verification requests which are immediately cancelled
Fixes https://github.com/vector-im/riot-web/issues/10083 Fixes https://github.com/vector-im/riot-web/issues/9197 Fixes https://github.com/vector-im/riot-web/issues/8629 The issue is partially fixed by https://github.com/matrix-org/matrix-react-sdk/pull/3123 in that users would no longer see "Incoming request", but would launch their client to a bunch of "key verification cancelled" dialogs. To work around this, we just don't handle key verification requests which we know are cancelled. The changes are a bit awkward (flagging the event as cancelled instead of filtering it) because: * We probably don't want to prevent events getting sent over the EventEmitter because applications may still rely on them. * The cypto side only has visibility of 1 event at a time, so it needs to have some kind of flag to rely on. An attempt has been made to generalize the new event flag for possible future cases.
This commit is contained in:
@@ -1648,6 +1648,11 @@ Crypto.prototype._onRoomKeyEvent = function(event) {
|
||||
* @param {module:models/event.MatrixEvent} event verification request event
|
||||
*/
|
||||
Crypto.prototype._onKeyVerificationRequest = function(event) {
|
||||
if (event.isCancelled()) {
|
||||
logger.warn("Ignoring flagged verification request from " + event.getSender());
|
||||
return;
|
||||
}
|
||||
|
||||
const content = event.getContent();
|
||||
if (!("from_device" in content) || typeof content.from_device !== "string"
|
||||
|| !("transaction_id" in content) || typeof content.from_device !== "string"
|
||||
@@ -1764,6 +1769,11 @@ Crypto.prototype._onKeyVerificationRequest = function(event) {
|
||||
* @param {module:models/event.MatrixEvent} event verification start event
|
||||
*/
|
||||
Crypto.prototype._onKeyVerificationStart = function(event) {
|
||||
if (event.isCancelled()) {
|
||||
logger.warn("Ignoring flagged verification start from " + event.getSender());
|
||||
return;
|
||||
}
|
||||
|
||||
const sender = event.getSender();
|
||||
const content = event.getContent();
|
||||
const transactionId = content.transaction_id;
|
||||
|
||||
Reference in New Issue
Block a user