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

`OlmEncryption.encryptMessage()`: `devices` can be null

Open
#2,372 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

This came up while iterating #2137;

In `OlmEncryption.encryptMessage`, when iterating over devices per user, the function calls `getStoredDevicesForUser`, which can return `null`.

This does not throw an error, as any comparison operation with `undefined` is `false`.

https://github.com/matrix-org/matrix-js-sdk/blob/c1abab688f9b524944c19d7d8486eb27a263e743/src/crypto/algorithms/olm.ts#L123

(Looking further into the code, I'm not sure if this is a real bug, or if this is (accidental) intended behavior.)

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/olm.ts around line 123 and trace getStoredDevicesForUser to determine whether null is an expected result or an unhandled bug. Confirm the intended behavior for a null device list, then update the implementation and relevant coverage if the behavior is incorrect.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.