-
-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keep track of event ID and timestamp of decrypted messages #555
Conversation
This is to avoid false positives when detecting replay attacks. fixes: element-hq/element-web#3712 Signed-off-by: Hubert Chathi <[email protected]>
suggestions welcome for how to format lines 833 and 834 of src/crypto/OlmDevice.js to avoid the lint error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. A few comments below.
src/crypto/OlmDevice.js
Outdated
const messageIndexKey = senderKey + "|" + sessionId + "|" + res.message_index; | ||
if (messageIndexKey in self._inboundGroupSessionMessageIndexes) { | ||
if (messageIndexKey in self._inboundGroupSessionMessageIndexes | ||
&& (argumentsLength <= 4 // Compatibility for older old versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't worry about this
src/crypto/OlmDevice.js
Outdated
// | ||
// Keys are strings of form "<senderKey>|<session_id>|<message_index>" | ||
// Values are true. | ||
// Values are objects containing the event ID and timestamp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you specify the keys here?
"values are objects of the format {id: <event id>, timestamp: <ts>}
"
src/crypto/OlmDevice.js
Outdated
if (messageIndexKey in self._inboundGroupSessionMessageIndexes | ||
&& (argumentsLength <= 4 // Compatibility for older old versions. | ||
|| self._inboundGroupSessionMessageIndexes[messageIndexKey].id !== eventId | ||
|| self._inboundGroupSessionMessageIndexes[messageIndexKey].timestamp !== timestamp)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fix the lint, pull out a local var as @krombel suggested in riot-dev. tmp
is a rubbish name though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know why I called it "suggestion" here 😎
Signed-off-by: Hubert Chathi <[email protected]>
@richvdh this PR is ready for re-review |
Thanks! |
…attacks ref: matrix-org/matrix-js-sdk#554 and matrix-org/matrix-js-sdk#555 Signed-off-by: Hubert Chathi <[email protected]>
This is to avoid false positives when detecting replay attacks.
fixes: element-hq/element-web#3712
Signed-off-by: Hubert Chathi [email protected]
@richvdh PTAL