Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit d087053

Browse files
Throw error if asked to jump forward in chain by over 2000 (#43)
As libsignal-protocol-java has had for more than three years. This check was present when it was first pulled out into its own repo in late 2014: https://github.com/signalapp/libsignal-protocol-java/blob/60800e155612bea797eed93c67046a23d26054cc/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java#L383
1 parent 5679fe7 commit d087053

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

dist/libsignal-protocol.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36303,6 +36303,10 @@ SessionCipher.prototype = {
3630336303
return Promise.resolve(); // Already calculated
3630436304
}
3630536305

36306+
if (counter - chain.chainKey.counter > 2000) {
36307+
throw new Error('Over 2000 messages into the future!');
36308+
}
36309+
3630636310
if (chain.chainKey.key === undefined) {
3630736311
throw new Error("Got invalid request to extend chain after it was already closed");
3630836312
}

src/SessionCipher.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ SessionCipher.prototype = {
287287
return Promise.resolve(); // Already calculated
288288
}
289289

290+
if (counter - chain.chainKey.counter > 2000) {
291+
throw new Error('Over 2000 messages into the future!');
292+
}
293+
290294
if (chain.chainKey.key === undefined) {
291295
throw new Error("Got invalid request to extend chain after it was already closed");
292296
}

0 commit comments

Comments
 (0)