Skip to content
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

Handle MatrixRTC encryption keys arriving out of order #4345

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

hughns
Copy link
Member

@hughns hughns commented Aug 9, 2024

This change ensures that if an older key is received after a newer one then it isn't allowed to overwrite the newer one. Resolves element-hq/element-call#2549

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

Copy link

@fkwp fkwp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hughns hughns requested a review from AndrewFerr August 14, 2024 14:29
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
src/matrixrtc/MatrixRTCSession.ts Outdated Show resolved Hide resolved
Comment on lines +434 to +436
if (!this.encryptionKeys.has(participantId)) {
this.encryptionKeys.set(participantId, []);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a tidy way to avoid all of the timestamp / keysEqual checks for when it's known from the start that there's no existing key for the participant...but since that was the case even before this PR, we can revisit this later.

Co-authored-by: Andrew Ferrazzutti <[email protected]>
@hughns hughns added this pull request to the merge queue Aug 15, 2024
Merged via the queue into develop with commit 87eddaf Aug 15, 2024
26 checks passed
@hughns hughns deleted the hughns/rtc-ignore-stale-keys branch August 15, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Per-participant sender keys can be processed out of order leading to InvalidKey: Decryption failed errors
3 participants