mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-18 14:37:32 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49675f68ad | ||
|
|
ceafc6f58d | ||
|
|
467e335c90 | ||
|
|
902e54b525 | ||
|
|
4ef487f40e | ||
|
|
32bfe5f129 | ||
|
|
07d4c6f304 | ||
|
|
b3d099a52a | ||
|
|
92f9531def | ||
|
|
a3d23c3718 | ||
|
|
055c430e77 | ||
|
|
df5e03f3b4 |
No files matched your search
@@ -71,7 +71,7 @@ runs:
|
||||
|
||||
- name: Install timelord-cli and git-warp-time
|
||||
if: steps.check-binaries.outputs.need-install == 'true'
|
||||
uses: https://github.com/taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2
|
||||
uses: https://github.com/taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2
|
||||
with:
|
||||
tool: git-warp-time,timelord-cli@3.0.1
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
name: Renovate
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/renovatebot/renovate:44.227.4@sha256:e09d40686f73d43b2c1e4667cb47d3c1d24a6ac730b74ce7aced9c84f68594f1
|
||||
image: ghcr.io/renovatebot/renovate:44.241.0@sha256:22d22b4ca7d768b5b469309d34379783bf91cd94a58faecf1cd0f4528a65d21c
|
||||
options: --tmpfs /tmp:exec
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
Generated
+44
-44
@@ -940,7 +940,7 @@ dependencies = [
|
||||
"hyper",
|
||||
"itertools 0.15.0",
|
||||
"lettre",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"reqwest 0.13.5",
|
||||
"ruma",
|
||||
"ruminuwuity",
|
||||
@@ -949,6 +949,7 @@ dependencies = [
|
||||
"sha1 0.11.0",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wildmatch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -991,7 +992,7 @@ dependencies = [
|
||||
"ipaddress",
|
||||
"lettre",
|
||||
"libc",
|
||||
"libloading 0.9.0",
|
||||
"libloading 0.9.1",
|
||||
"lock_api 0.5.0",
|
||||
"maplit",
|
||||
"nix",
|
||||
@@ -1003,7 +1004,7 @@ dependencies = [
|
||||
"opentelemetry_sdk",
|
||||
"parking_lot",
|
||||
"prometheus",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"resolvematrix",
|
||||
@@ -1124,7 +1125,7 @@ dependencies = [
|
||||
"openidconnect",
|
||||
"opentelemetry",
|
||||
"p256 0.14.0",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"regex",
|
||||
"reqwest 0.12.28",
|
||||
"reqwest 0.13.5",
|
||||
@@ -1914,9 +1915,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "email-encoding"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420b9da095f052ea597503e39073b5b3c522f7db933fbac202d91d24492693fd"
|
||||
checksum = "9f690ae2169f2ceb3f45b28b6fcd8fa16839f2f5c8818546774b9425f5f71004"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"memchr",
|
||||
@@ -2487,7 +2488,7 @@ dependencies = [
|
||||
"idna",
|
||||
"ipnet",
|
||||
"jni",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"thiserror 2.0.21",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
@@ -2507,7 +2508,7 @@ dependencies = [
|
||||
"jni",
|
||||
"once_cell",
|
||||
"prefix-trie",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"ring",
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2533,7 +2534,7 @@ dependencies = [
|
||||
"ndk-context",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"resolv-conf",
|
||||
"serde",
|
||||
"smallvec",
|
||||
@@ -2946,9 +2947,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ipaddress"
|
||||
version = "0.2.11"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67a97d7409c3ade4304acbff6b33b915af4564c42bf6e383651ced09bd6a2bce"
|
||||
checksum = "e0ae5a9c049476ef23026df39fe92a8d83c1d8b670b975f095cb4d5a3b13d43e"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
@@ -3188,9 +3189,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lettre"
|
||||
version = "0.11.23"
|
||||
version = "0.11.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2c646bd5cc763b1087b15493e29a64be6147ba8f19342004fa52048ee596eae"
|
||||
checksum = "f294f3d7cdb313e578acef7d7727d4e8d897e0fcd0d6d58c19959cec95073f19"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.23.1",
|
||||
@@ -3234,9 +3235,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
|
||||
checksum = "a1832accd5a4ca2795ace4d05d15c4039be15b62d3b950eff99746a990e3cc10"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link",
|
||||
@@ -4610,7 +4611,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"getrandom 0.4.3",
|
||||
"lru-slab",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"rand_pcg",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
@@ -4687,9 +4688,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.10.3"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
|
||||
checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11"
|
||||
dependencies = [
|
||||
"chacha20",
|
||||
"getrandom 0.4.3",
|
||||
@@ -5036,7 +5037,7 @@ dependencies = [
|
||||
"js_int",
|
||||
"konst",
|
||||
"percent-encoding",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"regex",
|
||||
"ruma-identifiers-validation",
|
||||
"ruma-macros",
|
||||
@@ -5086,7 +5087,7 @@ dependencies = [
|
||||
"js_int",
|
||||
"memchr",
|
||||
"mime",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"ruma-common",
|
||||
"ruma-events",
|
||||
"ruma-signatures",
|
||||
@@ -5142,7 +5143,7 @@ dependencies = [
|
||||
"ed25519-dalek",
|
||||
"memchr",
|
||||
"pkcs8 0.11.0",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"ruma-common",
|
||||
"ruma-events",
|
||||
"serde_json",
|
||||
@@ -5477,9 +5478,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c2c887f17023c9462a4202176efc33ca7228f9c30c0141c765ab534ab2d36b"
|
||||
checksum = "d7bc7fb14982f395d53924f4feebd48c6cc136399c49ac2160dcf2b260e74b75"
|
||||
dependencies = [
|
||||
"cfg_aliases",
|
||||
"httpdate",
|
||||
@@ -5497,9 +5498,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-backtrace"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c391d4330f3b37fdddf2b928151244e8c2dc0cfea1740e455cc8942af436f919"
|
||||
checksum = "f68328b53eb7defc20f993ed7cd1f4ce10d06feecefdf914db062ce2523e4b77"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"regex",
|
||||
@@ -5508,9 +5509,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-contexts"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "654dacb94135c713e1dcbff01314a83d333f0e62f76b91fed5ab87415075530c"
|
||||
checksum = "1d57fb52d1e5d76cc5a7415428004699d9e6d498859a7acc8e05becc57dad81f"
|
||||
dependencies = [
|
||||
"hostname",
|
||||
"libc",
|
||||
@@ -5522,22 +5523,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-core"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edcb294ca821e5c5624edaf33535eb18b06ef4f8675201d3e4d81ce325741692"
|
||||
checksum = "8367f7f31654b35453e20c8aca06e0ecf5a4d4793e33be139c1581e475a94e6a"
|
||||
dependencies = [
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"sentry-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sentry-debug-images"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74835055f6a57b78c0e13f941b460e39edc1899b05fe31dd47cd02367f70888f"
|
||||
checksum = "386f4ce2364e58f2ca811f388a0427fa13784bbe7aee85f302e901ef4b00fab9"
|
||||
dependencies = [
|
||||
"findshlibs",
|
||||
"sentry-core",
|
||||
@@ -5545,9 +5545,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-log"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f24141aaeb20c731719b33077f1063a79e07eef63a4954530559c067ba046aad"
|
||||
checksum = "c938358d54c65a79fea165a447ae0eabc5717f23ba482ceee279c5645f0ccad3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"log",
|
||||
@@ -5556,9 +5556,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-panic"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5d28522f81ed90510ec43ed01cb1873a393b329dc719f93335b4c75fbef05d1"
|
||||
checksum = "2ab095af8f107e893941f857d8e204f5d25404247c34af131c7d199e3021679f"
|
||||
dependencies = [
|
||||
"sentry-backtrace",
|
||||
"sentry-core",
|
||||
@@ -5566,9 +5566,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-tower"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "057730796d82b72f35f57e66fc41c2b9e334eb3edf5030dd18d3b1f88d062c78"
|
||||
checksum = "18f29b19179ae36e6318c71f6ee18d1e0db8bbe8e7b7f213c2aba9e721b650fb"
|
||||
dependencies = [
|
||||
"http",
|
||||
"pin-project",
|
||||
@@ -5580,9 +5580,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-tracing"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec67c296aadc41d4d41b64738908c51cacddf99edebe7a2b476f9bf40de93ff5"
|
||||
checksum = "a7cae82b121a812e69a1cfaaacb800112f5f261f362fbf5a08e13d1c11ef349e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"sentry-backtrace",
|
||||
@@ -5593,13 +5593,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sentry-types"
|
||||
version = "0.49.5"
|
||||
version = "0.49.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83d84a36b6bdeeb7813976fb899fca45d94540d2e2b80eac91ba66b4c654d8f0"
|
||||
checksum = "03da7c1f79d001b4f18e277f8207470efb262fb94c761baa195873d2ace8eb8a"
|
||||
dependencies = [
|
||||
"debugid",
|
||||
"hex",
|
||||
"rand 0.10.3",
|
||||
"rand 0.10.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.21",
|
||||
|
||||
@@ -272,6 +272,9 @@ version = "0.5.2"
|
||||
[workspace.dependencies.libloading]
|
||||
version = "0.9.0"
|
||||
|
||||
[workspace.dependencies.wildmatch]
|
||||
version = "2.7.0"
|
||||
|
||||
# Validating urls in config, was already a transitive dependency
|
||||
[workspace.dependencies.url]
|
||||
version = "2.5.8"
|
||||
|
||||
+8
-3
@@ -23,12 +23,15 @@ to encourage users to stay up-to-date with the latest release, and we have no co
|
||||
We appreciate the efforts of security researchers and the community in identifying and reporting vulnerabilities. To
|
||||
ensure that potential vulnerabilities are addressed properly, please follow these guidelines:
|
||||
|
||||
1. **Contact members of the team directly** over E2EE private message.
|
||||
1. **Contact _all_ members of the team** over E2EE private message on Matrix.
|
||||
Add each contact to the same encrypted room. **Do not message maintainers individually**.
|
||||
If you cannot reach us from matrix.org, please try [another server][sl] (e.g. continuwuity.rocks).
|
||||
- [@jade:ellis.link](https://matrix.to/#/@jade:ellis.link)
|
||||
- [@nex:nexy7574.co.uk](https://matrix.to/#/@nex:nexy7574.co.uk)
|
||||
- [@ginger:gingershaped.computer](https://matrix.to/#/@ginger:gingershaped.computer)
|
||||
2. **Email the security team** at [security@continuwuity.org](mailto:security@continuwuity.org). This is not E2EE, so
|
||||
don't include sensitive details.
|
||||
don't include sensitive details. Do not ask where to send sensitive details either; that
|
||||
information is included in this security policy. We may not respond to emails that do this.
|
||||
3. **Do not disclose the vulnerability publicly** until a fix has been pushed to the main branch.
|
||||
4. **Provide detailed information** about the vulnerability, including:
|
||||
- A clear description of the issue
|
||||
@@ -42,6 +45,8 @@ ensure that potential vulnerabilities are addressed properly, please follow thes
|
||||
If you have any doubts about a potential security vulnerability, contact us via private channels first! We'd prefer that
|
||||
you bother us, instead of having a vulnerability disclosed without a fix.
|
||||
|
||||
[sl]: https://servers.joinmatrix.org
|
||||
|
||||
### Terms for credit
|
||||
|
||||
Before reporting a vulnerability, please remember that we are a small team maintaining a large codebase depended upon by
|
||||
@@ -105,4 +110,4 @@ When security vulnerabilities are identified:
|
||||
|
||||
---
|
||||
|
||||
This security policy was last updated on May 25, 2025.
|
||||
This security policy was last updated on November 17th, 2026.
|
||||
@@ -0,0 +1 @@
|
||||
Legacy `/sync` now honours the `room.rooms`, `room.not_rooms`, `account_data.types` and `account_data.not_types` filter fields instead of returning every room and all account data. Contributed by @eleboucher.
|
||||
@@ -0,0 +1 @@
|
||||
Requests waiting on `/_matrix/client/v3/sync` can now be interrupted by the server shutdown, unblocking the 30-second shutdown delay imposed on a quiet server.
|
||||
@@ -0,0 +1 @@
|
||||
`/_matrix/client/v3/sync` no longer waits 30 seconds if the `timeout` parameter is omitted or set to zero, correctly reflecting the specification's rule that such requests should return immediately, even if they are empty.
|
||||
@@ -0,0 +1 @@
|
||||
The sticky events feature flag is correctly advertised in `/_matrix/client/versions` again after it was accidentally removed in #2517.
|
||||
@@ -87,6 +87,7 @@ serde.workspace = true
|
||||
sha1.workspace = true
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
wildmatch.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -64,7 +64,7 @@ pub(super) async fn load_joined_room(
|
||||
services: &Services,
|
||||
sync_context: SyncContext<'_>,
|
||||
ref room_id: OwnedRoomId,
|
||||
) -> Result<(JoinedRoom, DeviceListUpdates)> {
|
||||
) -> Result<JoinedRoom> {
|
||||
/*
|
||||
Building a sync response involves many steps which all depend on each other.
|
||||
To parallelize the process as much as possible, each step is divided into its own function,
|
||||
@@ -80,7 +80,6 @@ pub(super) async fn load_joined_room(
|
||||
sticky,
|
||||
summary,
|
||||
notification_counts,
|
||||
device_list_updates,
|
||||
},
|
||||
) = try_join3(
|
||||
build_account_data(services, sync_context, room_id),
|
||||
@@ -117,7 +116,7 @@ pub(super) async fn load_joined_room(
|
||||
unread_thread_notifications: BTreeMap::new(),
|
||||
});
|
||||
|
||||
Ok((joined_room, device_list_updates))
|
||||
Ok(joined_room)
|
||||
}
|
||||
|
||||
/// Collect changes to the syncing user's account data events.
|
||||
@@ -263,7 +262,6 @@ struct StateAndTimeline {
|
||||
sticky: Sticky,
|
||||
summary: Option<RoomSummary>,
|
||||
notification_counts: Option<UnreadNotificationsCount>,
|
||||
device_list_updates: DeviceListUpdates,
|
||||
}
|
||||
|
||||
async fn build_sticky_events(
|
||||
@@ -377,24 +375,14 @@ async fn build_state_and_timeline(
|
||||
debug_warn!("timeline for newly joined room is empty");
|
||||
}
|
||||
|
||||
let (summary, device_list_updates) = try_join(
|
||||
build_room_summary(
|
||||
services,
|
||||
sync_context,
|
||||
room_id,
|
||||
shortstatehashes,
|
||||
&timeline,
|
||||
&state_events,
|
||||
joined_since_last_sync,
|
||||
),
|
||||
build_device_list_updates(
|
||||
services,
|
||||
sync_context,
|
||||
room_id,
|
||||
shortstatehashes,
|
||||
&state_events,
|
||||
joined_since_last_sync,
|
||||
),
|
||||
let summary = build_room_summary(
|
||||
services,
|
||||
sync_context,
|
||||
room_id,
|
||||
shortstatehashes,
|
||||
&timeline,
|
||||
&state_events,
|
||||
joined_since_last_sync,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -430,7 +418,6 @@ async fn build_state_and_timeline(
|
||||
sticky,
|
||||
summary,
|
||||
notification_counts,
|
||||
device_list_updates,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -854,35 +841,34 @@ async fn build_heroes(
|
||||
.await
|
||||
}
|
||||
|
||||
/// Collect updates to users' device lists for E2EE.
|
||||
#[tracing::instrument(level = "debug", skip_all)]
|
||||
async fn build_device_list_updates(
|
||||
/// Collect updates to users' device lists for E2EE in a joined room.
|
||||
#[tracing::instrument(level = "debug", skip_all, fields(%room_id))]
|
||||
pub(super) async fn load_device_list_updates(
|
||||
services: &Services,
|
||||
SyncContext {
|
||||
sync_context: SyncContext<'_>,
|
||||
room_id: &RoomId,
|
||||
) -> Result<DeviceListUpdates> {
|
||||
let SyncContext {
|
||||
syncing_user,
|
||||
last_sync_end_count,
|
||||
current_count,
|
||||
..
|
||||
}: SyncContext<'_>,
|
||||
room_id: &RoomId,
|
||||
ShortStateHashes { current_shortstatehash, .. }: ShortStateHashes,
|
||||
state_events: &Vec<PduEvent>,
|
||||
joined_since_last_sync: bool,
|
||||
) -> Result<DeviceListUpdates> {
|
||||
let is_encrypted_room = services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.state_get(current_shortstatehash, &StateEventType::RoomEncryption, "")
|
||||
.is_ok();
|
||||
} = sync_context;
|
||||
|
||||
let mut device_list_updates = DeviceListUpdates::new();
|
||||
|
||||
// initial syncs don't include device updates, and rooms which aren't
|
||||
// encrypted don't affect them, so return early in either of those cases
|
||||
if last_sync_end_count.is_none() || !(is_encrypted_room.await) {
|
||||
return Ok(DeviceListUpdates::new());
|
||||
if last_sync_end_count.is_none()
|
||||
|| !services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.is_encrypted_room(room_id)
|
||||
.await
|
||||
{
|
||||
return Ok(device_list_updates);
|
||||
}
|
||||
|
||||
let mut device_list_updates = DeviceListUpdates::new();
|
||||
|
||||
// add users with changed keys to the `changed` list
|
||||
services
|
||||
.users
|
||||
@@ -893,19 +879,56 @@ async fn build_device_list_updates(
|
||||
})
|
||||
.await;
|
||||
|
||||
// add users who now share encrypted rooms to `changed` and
|
||||
// users who no longer share encrypted rooms to `left`
|
||||
for state_event in state_events {
|
||||
if state_event.kind == RoomMember {
|
||||
let Some(content): Option<RoomMemberEventContent> = state_event.get_content().ok()
|
||||
let shortstatehashes = fetch_shortstatehashes(services, sync_context, room_id).await?;
|
||||
let ShortStateHashes {
|
||||
current_shortstatehash,
|
||||
last_sync_end_shortstatehash,
|
||||
} = shortstatehashes;
|
||||
|
||||
if check_joined_since_last_sync(services, shortstatehashes, sync_context).await? {
|
||||
// the syncing user now shares an encrypted room with every member
|
||||
services
|
||||
.rooms
|
||||
.state_cache
|
||||
.room_members(room_id)
|
||||
.ready_for_each(|user_id| {
|
||||
device_list_updates.changed.insert(user_id);
|
||||
})
|
||||
.await;
|
||||
} else if let Some(last_sync_end_shortstatehash) = last_sync_end_shortstatehash
|
||||
&& last_sync_end_shortstatehash != current_shortstatehash
|
||||
{
|
||||
// add users who now share encrypted rooms to `changed` and
|
||||
// users who no longer share encrypted rooms to `left`
|
||||
let state_added = services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.state_added((last_sync_end_shortstatehash, current_shortstatehash))
|
||||
.await?;
|
||||
|
||||
for (shortstatekey, _) in state_added {
|
||||
let Ok((StateEventType::RoomMember, state_key)) = services
|
||||
.rooms
|
||||
.short
|
||||
.get_statekey_from_short(shortstatekey)
|
||||
.await
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Some(user_id): Option<OwnedUserId> = state_event
|
||||
.state_key
|
||||
.as_ref()
|
||||
.and_then(|key| key.parse().ok())
|
||||
let Ok(user_id) = OwnedUserId::try_from(state_key.as_str()) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Ok(content): Result<RoomMemberEventContent> = services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.state_get_content(
|
||||
current_shortstatehash,
|
||||
&StateEventType::RoomMember,
|
||||
user_id.as_str(),
|
||||
)
|
||||
.await
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
@@ -921,7 +944,7 @@ async fn build_device_list_updates(
|
||||
| Leave if !shares_encrypted_room => {
|
||||
device_list_updates.left.insert(user_id);
|
||||
},
|
||||
| Join if joined_since_last_sync || shares_encrypted_room => {
|
||||
| Join if shares_encrypted_room => {
|
||||
device_list_updates.changed.insert(user_id);
|
||||
},
|
||||
| _ => (),
|
||||
|
||||
+117
-21
@@ -3,7 +3,6 @@ mod left;
|
||||
mod state;
|
||||
|
||||
use std::{
|
||||
cmp::{self},
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
time::Duration,
|
||||
};
|
||||
@@ -21,7 +20,7 @@ use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture};
|
||||
use ruma::{
|
||||
DeviceId, OwnedUserId, RoomId, UserId,
|
||||
api::client::{
|
||||
filter::FilterDefinition,
|
||||
filter::{self, FilterDefinition, RoomFilter},
|
||||
sync::sync_events::{
|
||||
self, DeviceLists,
|
||||
v3::{
|
||||
@@ -39,13 +38,17 @@ use service::{
|
||||
account_data::AnyRawAccountDataEvent,
|
||||
rooms::lazy_loading::{self, MemberSet, Options as _},
|
||||
};
|
||||
use wildmatch::WildMatch;
|
||||
|
||||
use super::{load_timeline, share_encrypted_room};
|
||||
use crate::{
|
||||
Ruma,
|
||||
client::{
|
||||
is_ignored_invite,
|
||||
sync::v3::{joined::load_joined_room, left::load_left_room},
|
||||
sync::v3::{
|
||||
joined::{load_device_list_updates, load_joined_room},
|
||||
left::load_left_room,
|
||||
},
|
||||
},
|
||||
client_ip::ClientIp,
|
||||
};
|
||||
@@ -203,7 +206,12 @@ pub(crate) async fn sync_events_route(
|
||||
|
||||
let mut wake_receiver = services.sync.subscribe_to_wake(sender_user);
|
||||
let response = build_sync_events(&services, &body).await?;
|
||||
if body.body.full_state
|
||||
|
||||
let timeout_duration = body.body.timeout.unwrap_or_default();
|
||||
// If the timeout is zero, request has full_state=true, or there's
|
||||
// meaningful data to return, do so immediately.
|
||||
if timeout_duration.is_zero()
|
||||
|| body.body.full_state
|
||||
|| !(response.rooms.is_empty()
|
||||
&& response.presence.is_empty()
|
||||
&& response.account_data.is_empty()
|
||||
@@ -213,11 +221,15 @@ pub(crate) async fn sync_events_route(
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
// Hang a few seconds so requests are not spammed
|
||||
// Stop hanging if new info arrives
|
||||
let default = Duration::from_secs(30);
|
||||
let duration = cmp::min(body.body.timeout.unwrap_or(default), default);
|
||||
_ = tokio::time::timeout(duration, wake_receiver.changed()).await;
|
||||
// Otherwise, wait for a wake signal to rebuild changes. Cap timeout at 30
|
||||
// seconds (this isn't specced, but a reasonable cap since most clients have
|
||||
// a 30-second polling interval).
|
||||
let duration = timeout_duration.min(Duration::from_secs(30));
|
||||
let mut shutdown_signal = services.server.signal.subscribe();
|
||||
tokio::select! {
|
||||
_ = tokio::time::timeout(duration, wake_receiver.changed()) => {},
|
||||
_ = shutdown_signal.recv() => return Err!(Request(Unknown("Server is shutting down"), SERVICE_UNAVAILABLE)),
|
||||
};
|
||||
|
||||
// Retry returning data
|
||||
build_sync_events(&services, &body).await
|
||||
@@ -271,34 +283,47 @@ pub(crate) async fn build_sync_events(
|
||||
.rooms
|
||||
.state_cache
|
||||
.rooms_joined(syncing_user)
|
||||
.ready_filter(|room_id| room_selected(&filter.room, room_id))
|
||||
.broad_filter_map(|room_id| async {
|
||||
let joined_room = load_joined_room(services, context, room_id.clone()).await;
|
||||
|
||||
match joined_room {
|
||||
| Ok((room, updates)) => Some((room_id, room, updates)),
|
||||
| Ok(room) => Some((room_id, room)),
|
||||
| Err(err) => {
|
||||
error!(?err, %room_id, "error loading joined room");
|
||||
None
|
||||
},
|
||||
}
|
||||
})
|
||||
.ready_fold(
|
||||
(BTreeMap::new(), DeviceListUpdates::new()),
|
||||
|(mut joined_rooms, mut all_updates), (room_id, joined_room, updates)| {
|
||||
all_updates.merge(updates);
|
||||
.ready_fold(BTreeMap::new(), |mut joined_rooms, (room_id, joined_room)| {
|
||||
if !joined_room.is_empty() {
|
||||
joined_rooms.insert(room_id, joined_room);
|
||||
}
|
||||
|
||||
if !joined_room.is_empty() {
|
||||
joined_rooms.insert(room_id, joined_room);
|
||||
}
|
||||
joined_rooms
|
||||
});
|
||||
|
||||
(joined_rooms, all_updates)
|
||||
},
|
||||
);
|
||||
// a filtered out room still contributes its device list updates
|
||||
let device_list_updates = services
|
||||
.rooms
|
||||
.state_cache
|
||||
.rooms_joined(syncing_user)
|
||||
.broad_filter_map(|room_id| async move {
|
||||
load_device_list_updates(services, context, &room_id)
|
||||
.await
|
||||
.inspect_err(|err| error!(?err, %room_id, "error loading device list updates"))
|
||||
.ok()
|
||||
})
|
||||
.ready_fold(DeviceListUpdates::new(), |mut all_updates, updates| {
|
||||
all_updates.merge(updates);
|
||||
all_updates
|
||||
});
|
||||
|
||||
let left_rooms = services
|
||||
.rooms
|
||||
.state_cache
|
||||
.rooms_left(syncing_user)
|
||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
||||
.broad_filter_map(|(room_id, leave_pdu)| async {
|
||||
let left_room = load_left_room(services, context, room_id.clone(), leave_pdu).await;
|
||||
|
||||
@@ -317,6 +342,7 @@ pub(crate) async fn build_sync_events(
|
||||
.rooms
|
||||
.state_cache
|
||||
.rooms_invited(syncing_user)
|
||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
||||
.wide_filter_map(async |(room_id, invite_state)| {
|
||||
if is_ignored_invite(services, syncing_user, &room_id).await {
|
||||
None
|
||||
@@ -347,6 +373,7 @@ pub(crate) async fn build_sync_events(
|
||||
.rooms
|
||||
.state_cache
|
||||
.rooms_knocked(syncing_user)
|
||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
||||
.fold_default(|mut knocked_rooms: BTreeMap<_, _>, (room_id, knock_state)| async move {
|
||||
let knock_count = services
|
||||
.rooms
|
||||
@@ -376,6 +403,13 @@ pub(crate) async fn build_sync_events(
|
||||
.account_data
|
||||
.changes_since(None, syncing_user, last_sync_end_count, Some(current_count))
|
||||
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Global))
|
||||
.ready_filter(|event| {
|
||||
event
|
||||
.get_field::<String>("type")
|
||||
.ok()
|
||||
.flatten()
|
||||
.is_some_and(|event_type| type_selected(&filter.account_data, &event_type))
|
||||
})
|
||||
.collect();
|
||||
|
||||
let to_device_events = services
|
||||
@@ -404,7 +438,8 @@ pub(crate) async fn build_sync_events(
|
||||
.list_unused_fallback_key_types(syncing_user, syncing_device);
|
||||
|
||||
let (
|
||||
(joined_rooms, mut device_list_updates),
|
||||
joined_rooms,
|
||||
mut device_list_updates,
|
||||
left_rooms,
|
||||
invited_rooms,
|
||||
knocked_rooms,
|
||||
@@ -417,6 +452,7 @@ pub(crate) async fn build_sync_events(
|
||||
) = async {
|
||||
futures::join!(
|
||||
joined_rooms,
|
||||
device_list_updates,
|
||||
left_rooms,
|
||||
invited_rooms,
|
||||
knocked_rooms,
|
||||
@@ -465,6 +501,24 @@ pub(crate) async fn build_sync_events(
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
fn room_selected(filter: &RoomFilter, room_id: &RoomId) -> bool {
|
||||
!filter.not_rooms.iter().any(|not_room| not_room == room_id)
|
||||
&& filter
|
||||
.rooms
|
||||
.as_ref()
|
||||
.is_none_or(|rooms| rooms.iter().any(|room| room == room_id))
|
||||
}
|
||||
|
||||
fn type_selected(filter: &filter::Filter, event_type: &str) -> bool {
|
||||
let matches = |pattern: &String| WildMatch::new(pattern).matches(event_type);
|
||||
|
||||
!filter.not_types.iter().any(matches)
|
||||
&& filter
|
||||
.types
|
||||
.as_ref()
|
||||
.is_none_or(|types| types.iter().any(matches))
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "presence", level = "debug", skip_all)]
|
||||
async fn process_presence_updates(
|
||||
services: &Services,
|
||||
@@ -528,3 +582,45 @@ async fn prepare_lazily_loaded_members(
|
||||
|
||||
lazily_loaded_members
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ruma::{owned_room_id, room_id};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn rooms_filter_selects_rooms() {
|
||||
let room_id = room_id!("!a:example.com");
|
||||
let mut filter = RoomFilter::default();
|
||||
assert!(room_selected(&filter, room_id));
|
||||
|
||||
filter.rooms = Some(Vec::new());
|
||||
assert!(!room_selected(&filter, room_id));
|
||||
|
||||
filter.rooms = Some(vec![room_id.to_owned()]);
|
||||
assert!(room_selected(&filter, room_id));
|
||||
|
||||
filter.not_rooms = vec![owned_room_id!("!a:example.com")];
|
||||
assert!(!room_selected(&filter, room_id));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn types_filter_selects_account_data() {
|
||||
let mut filter = filter::Filter::default();
|
||||
assert!(type_selected(&filter, "m.direct"));
|
||||
|
||||
filter.types = Some(Vec::new());
|
||||
assert!(!type_selected(&filter, "m.direct"));
|
||||
|
||||
filter.types = Some(vec!["m.direct".to_owned()]);
|
||||
assert!(type_selected(&filter, "m.direct"));
|
||||
|
||||
filter.types = Some(vec!["m.*".to_owned()]);
|
||||
assert!(type_selected(&filter, "m.direct"));
|
||||
assert!(!type_selected(&filter, "im.ponies.user_emotes"));
|
||||
|
||||
filter.not_types = vec!["m.direct".to_owned()];
|
||||
assert!(!type_selected(&filter, "m.direct"));
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,10 @@ pub fn versions() -> Vec<String> {
|
||||
pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
|
||||
BTreeMap::from_iter([
|
||||
// MatrixRTC (https://github.com/matrix-org/matrix-spec-proposals/pull/4143)
|
||||
// Expected for spec v1.20
|
||||
// Expected for spec v1.20/v2.0
|
||||
("org.matrix.msc4143".to_owned(), true),
|
||||
// Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
|
||||
// Expected for spec v1.20
|
||||
// Expected for spec v1.20/v2.0
|
||||
("org.matrix.simplified_msc3575".to_owned(), true),
|
||||
("org.matrix.msc4155".to_owned(), experiments.msc4155.is_enabled()),
|
||||
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
|
||||
@@ -48,5 +48,8 @@ pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
|
||||
("org.continuwuity.msc4484.unstable".to_owned(), experiments.msc4484.is_enabled()),
|
||||
("org.continuwuity.msc4560".to_owned(), experiments.msc4560.is_enabled()),
|
||||
("fi.mau.msc2815".to_owned(), experiments.msc2815.is_enabled()),
|
||||
// Sticky events (https://github.com/matrix-org/matrix-spec-proposals/pull/4354)
|
||||
// Proposal merged, expected for spec v1.20/v2.0
|
||||
("org.matrix.msc4354".to_owned(), true),
|
||||
])
|
||||
}
|
||||
@@ -25,7 +25,7 @@ http.workspace = true
|
||||
ruma.workspace = true
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
wildmatch = "2.7.0"
|
||||
wildmatch.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
|
||||
@@ -534,7 +534,7 @@ impl Service {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
if !pdu_fits(&value.clone()) {
|
||||
if !pdu_fits(&value) {
|
||||
warn!(
|
||||
"dropping incoming PDU {event_id} in room {room_id} from room join \
|
||||
because it exceeds 65535 bytes or is otherwise too large."
|
||||
|
||||
@@ -54,7 +54,7 @@ pub fn pdu_fits(owned_obj: &CanonicalJsonObject) -> bool {
|
||||
}
|
||||
// Now check the full PDU size
|
||||
match serde_json::to_string(owned_obj) {
|
||||
| Ok(s) => s.len() <= 65535,
|
||||
| Ok(s) => s.len() <= 65536,
|
||||
| Err(_) => false,
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ impl super::Service {
|
||||
{
|
||||
return match e {
|
||||
| Error::SignatureJson(ruma::signatures::JsonError::PduTooLarge) => {
|
||||
Err!(Request(TooLarge("Message/PDU is too long (exceeds 65535 bytes)")))
|
||||
Err!(Request(TooLarge("Message/PDU is too long (exceeds 65536 bytes)")))
|
||||
},
|
||||
| _ => Err!(Request(Unknown(warn!("Signing event failed: {e}")))),
|
||||
};
|
||||
@@ -330,9 +330,9 @@ impl super::Service {
|
||||
pdu_json
|
||||
.insert("event_id".into(), CanonicalJsonValue::String(pdu.event_id.clone().into()));
|
||||
// Verify that the *full* PDU isn't over 64KiB.
|
||||
if !pdu_fits(&pdu_json.clone()) {
|
||||
if !pdu_fits(&pdu_json) {
|
||||
// feckin huge PDU mate
|
||||
return Err!(Request(TooLarge("Message/PDU is too long (exceeds 65535 bytes)")));
|
||||
return Err!(Request(TooLarge("Message/PDU is too long (exceeds 65536 bytes)")));
|
||||
}
|
||||
|
||||
// Check with the policy server
|
||||
|
||||
Reference in new issue
Block a user