Repository navigation
Reject OTK uploads if clients exceed 500 server-side keys - #20162
Conversation
9fe1486 to
9c82f30
Compare
|
For links: the combination of matrix-org/matrix-rust-sdk#6780 and the js-sdk resulted in matrix-org/matrix-js-sdk#5501, which in turn led to people seeing decryption errors, which can't even be fixed by rolling back the client, since the incorrect OTKs have already been uploaded to the server. The goal here is to provide a backstop against similar client breakage in future by refusing to cooperate with such broken clients. Hopefully this will result in a user-visible "it's all horribly broken" error, which is better than silent breakage that manifests through decryption errors some time later. In any case, Synapse should have a guard against users uploading absurd numbers of OTKs. |
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
d663e95 to
c38aca1
Compare
anoadragon453
left a comment
There was a problem hiding this comment.
LGTM, other than one nit (which I can fix up). Thanks!
…#20162) Co-authored-by: Andrew Morgan <andrew@amorgan.xyz> Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Tested on NetBSD 10 amd64 with 2026Q3 environment.
Packaging changes:
- use maturin's tool.mk, to get the part that respects MAKE_JOBS
- patch mio, which had a pre-NetBSD10 type for kevent.udata, a
latent bug apparently exposed by a new libc crate, but fixable on
its own merits by code inspection.
# Synapse 1.162.0 (2026-09-29)
## Features
- Raise default room version to "12". Contributed by @jason-famedly @famedly. ([\#20130](element-hq/synapse#20130))
- Limit the number of end-to-end encryption one-time keys stored per device to 500 per algorithm, rejecting uploads which would exceed the limit with a `400 Bad Request`. ([\#20162](element-hq/synapse#20162))
- Add support for configuring a `username` for Redis connections, for Redis 6+ ACL authentication. ([\#20187](element-hq/synapse#20187))
- Add a rate limit on the client profile lookup endpoints, configurable via `rc_profile`. ([\#20218](element-hq/synapse#20218))
Tested on NetBSD 10 amd64 with 2026Q3 environment.
Packaging changes:
- use maturin's tool.mk, to get the part that respects MAKE_JOBS
- patch mio, which had a pre-NetBSD10 type for kevent.udata, a
latent bug apparently exposed by a new libc crate, but fixable on
its own merits by code inspection.
# Synapse 1.162.0 (2026-09-29)
## Features
- Raise default room version to "12". Contributed by @jason-famedly @famedly. ([\#20130](element-hq/synapse#20130))
- Limit the number of end-to-end encryption one-time keys stored per device to 500 per algorithm, rejecting uploads which would exceed the limit with a `400 Bad Request`. ([\#20162](element-hq/synapse#20162))
- Add support for configuring a `username` for Redis connections, for Redis 6+ ACL authentication. ([\#20187](element-hq/synapse#20187))
- Add a rate limit on the client profile lookup endpoints, configurable via `rc_profile`. ([\#20218](element-hq/synapse#20218))
matrix-org/matrix-rust-sdk#6780 fixed a long-standing issue in the Rust SDK where
OlmMachine::receive_sync_changesincorrectly treated a missingone_time_keys_countsas "no change", when (for sync v2) this means "no keys". This behaviour made it into the WASM SDK in release v18.5.0, which causes clients written using the JS SDK to endlessly upload OTKs on every sync.This PR introduces a server-side check to see if a device has uploaded over
500keys when it tries to upload more, errorring if this is the case. This should help inform client developers that something is wrong with their OTK implementation before it becomes a problem.Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.