Skip to content

Commit

Permalink
Check key index & key
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr committed Oct 30, 2023
1 parent 583e114 commit 2fe0828
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { MatrixError, MatrixEvent } from "../matrix";
import { randomString, secureRandomBase64 } from "../randomstring";
import { EncryptionKeysEventContent } from "./types";
import { decodeBase64, encodeUnpaddedBase64 } from "../base64";
import { isNumber } from "../utils";

const MEMBERSHIP_EXPIRY_TIME = 60 * 60 * 1000;
const MEMBER_EVENT_CHECK_PERIOD = 2 * 60 * 1000; // How often we check to see if we need to re-send our member event
Expand Down Expand Up @@ -462,6 +463,11 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
}

for (const key of content.keys) {
if (!key.key || !isNumber(key.index)) {
logger.warn(`Received m.call.encryption_keys with invalid entry: callId=${callId}`);
continue;
}

const encryptionKey = key.key;
const encryptionKeyIndex = key.index;

Expand Down

0 comments on commit 2fe0828

Please sign in to comment.