matrix-org / matrix-org/matrix-js-sdk

Megolm encryption rotation configuration

Open
#1,412 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Megolm encryption rotation configuration can coerce to 0 on null values. Initial configuration is configured here: https://github.com/matrix-org/matrix-js-sdk/blob/355da0f9a9c37fa348bc592e28ab4ecc6fbf824a/src/crypto/algorithms/megolm.js#L170-L179 Here it checks for undefined values, but not null.

If this happens, every time that rotation is checked (https://github.com/matrix-org/matrix-js-sdk/blob/355da0f9a9c37fa348bc592e28ab4ecc6fbf824a/src/crypto/algorithms/megolm.js#L74-L75), it starts a new session. It seems that null is coerced to 0 (or at least, is what I guess is happening).

I'm almost sure that this 2 parameters comes from a m.room.encryption event, but I could not find where this happens.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/crypto/algorithms/megolm.js at the initial configuration check around lines 170-179, then inspect the rotation check around lines 74-75. Trace how m.room.encryption events supply the two parameters and confirm that null values no longer cause repeated session creation during rotation checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.