瀏覽代碼

e2ee: don't pass plain frames to decoder if we are encrypting (#1116)

If we are encrypting and the key index from a (potentially unencrypted)
frame exceeds our key ring size (1 currently) drop the frame.

This is a heuristic. We currently don't have the signaling for whether a
remote end does encrypt its frames or not.
dev1
Philipp Hancke 5 年之前
父節點
當前提交
3ed8210620
No account linked to committer's email address
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7
    0
      modules/e2ee/E2EEContext.js

+ 7
- 0
modules/e2ee/E2EEContext.js 查看文件

@@ -341,6 +341,13 @@ export default class E2EEcontext {
341 341
                     controller.enqueue(encodedFrame);
342 342
                 }
343 343
             });
344
+        } else if (keyIndex >= this._cryptoKeyRing.length
345
+                && this._cryptoKeyRing[this._currentKeyIndex % this._cryptoKeyRing.length]) {
346
+            // If we are encrypting but don't have a key for the remote drop the frame.
347
+            // This is a heuristic since we don't know whether a packet is encrypted,
348
+            // do not have a checksum and do not have signaling for whether a remote participant does
349
+            // encrypt or not.
350
+            return;
344 351
         }
345 352
 
346 353
         // TODO: this just passes through to the decoder. Is that ok? If we don't know the key yet

Loading…
取消
儲存