matrix-org / matrix-org/matrix-rust-sdk

`OlmMachine::decrypt_room_event` should detect redacted events and return a different error

Open
#1,642 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Encryption
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

Currently if a redacted event is passed to `OlmMachine::decrypt_room_event` it will fail with error `UnsupportedAlgorithm`(?).
Given that the event is redacted, there won't be an `algorithm`field, so it's expected.

Nonetheless this will produce UTDs for redacted events, and sdk clients could falsely display them as UTD (in ER case report false positive UTD metrics).

Could it be possible to special case redacted event and return a successful decryption with an empty content, of type `m.room.message`? (and unknown alg)?

Redacted event could be detected by checking existence of `unsigned.redacted_because`

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 at OlmMachine::decrypt_room_event and inspect how redacted events are represented through unsigned.redacted_because and how UnsupportedAlgorithm is produced. Confirm the intended successful result for a redacted event: empty content, m.room.message type, and unknown algorithm, while avoiding a false UTD.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.