From a21b0918dc7946bec82fe14123d08d46497ada87 Mon Sep 17 00:00:00 2001
From: Renovate Bot
Date: Thu, 15 Oct 2026 05:17:59 +0000
Subject: [PATCH 001/342] chore(deps): update rust crate rustls to v0.23.46
[security]
---
Cargo.lock | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index a718f824f..deac9fff4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5290,9 +5290,9 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.23.45"
+version = "0.23.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
dependencies = [
"aws-lc-rs",
"log",
From 08301fba2abd967525db051b0d23094d4d830216 Mon Sep 17 00:00:00 2001
From: Jade Ellis
Date: Thu, 15 Oct 2026 11:22:04 +0100
Subject: [PATCH 002/342] fix: Correctly rebuild the build metadata crate when
git changes
---
src/build_metadata/build.rs | 71 ++++++++++++++++++++++++++++++++-----
1 file changed, 63 insertions(+), 8 deletions(-)
diff --git a/src/build_metadata/build.rs b/src/build_metadata/build.rs
index b605b7578..8e99a85e1 100644
--- a/src/build_metadata/build.rs
+++ b/src/build_metadata/build.rs
@@ -1,5 +1,10 @@
use std::{
- collections::BTreeMap, env, fmt::Write as FmtWrite, fs, io::Write, path::Path,
+ collections::BTreeMap,
+ env,
+ fmt::Write as FmtWrite,
+ fs,
+ io::Write,
+ path::{Path, PathBuf},
process::Command,
};
@@ -130,18 +135,68 @@ fn main() {
}
// --- Rerun Triggers ---
- // TODO: The git rerun triggers seem to always run
- // // Rerun if the git HEAD changes
- // println!("cargo:rerun-if-changed=.git/HEAD");
- // // Rerun if the ref pointed to by HEAD changes (e.g., new commit on
- // branch) if let Some(ref_path) = run_git_command(&["symbolic-ref",
- // "--quiet", "HEAD"]) { println!("cargo:rerun-if-changed=.git/{ref_path}"
- // ); }
+ let resolve_git_path = |path_str: &str| -> PathBuf {
+ let p = Path::new(path_str);
+ if p.is_absolute() {
+ p.to_path_buf()
+ } else {
+ Path::new(&manifest_dir).join(p)
+ }
+ };
+
+ // If workspace root has a .git file (e.g., git worktree or submodule),
+ // watch it
+ let workspace_git = metadata.workspace_root.as_std_path().join(".git");
+ if workspace_git.is_file() {
+ println!("cargo:rerun-if-changed={}", workspace_git.display());
+ }
+
+ // Rerun if the git HEAD changes
+ if let Some(git_head) = run_git_command(&["rev-parse", "--git-path", "HEAD"]) {
+ let head_path = resolve_git_path(&git_head);
+ if head_path.exists() {
+ println!("cargo:rerun-if-changed={}", head_path.display());
+ }
+ }
+
+ // Rerun if the ref pointed to by HEAD changes (e.g., new commit on branch)
+ if let Some(ref_name) = run_git_command(&["symbolic-ref", "--quiet", "HEAD"]) {
+ if let Some(git_ref) = run_git_command(&["rev-parse", "--git-path", &ref_name]) {
+ let ref_path = resolve_git_path(&git_ref);
+ if ref_path.exists() {
+ println!("cargo:rerun-if-changed={}", ref_path.display());
+ } else {
+ // If the loose ref file does not exist (e.g. refs are packed),
+ // watch the nearest existing ancestor directory
+ // so newly created refs trigger rerun.
+ let mut dir = ref_path.parent();
+ while let Some(d) = dir {
+ if d.exists() {
+ println!("cargo:rerun-if-changed={}", d.display());
+ break;
+ }
+ dir = d.parent();
+ }
+ }
+ }
+ }
+
+ // If packed-refs exists, watch it so git pack-refs or updates to packed
+ // refs trigger rerun
+ if let Some(git_packed) = run_git_command(&["rev-parse", "--git-path", "packed-refs"]) {
+ let packed_path = resolve_git_path(&git_packed);
+ if packed_path.exists() {
+ println!("cargo:rerun-if-changed={}", packed_path.display());
+ }
+ }
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH");
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH_SHORT");
println!("cargo:rerun-if-env-changed=GIT_REMOTE_URL");
println!("cargo:rerun-if-env-changed=GIT_REMOTE_COMMIT_URL");
+ println!("cargo:rerun-if-env-changed=CONTINUWUITY_VERSION_EXTRA");
+ println!("cargo:rerun-if-env-changed=CONDUWUIT_VERSION_EXTRA");
+ println!("cargo:rerun-if-env-changed=CONDUIT_VERSION_EXTRA");
}
fn generate_features_code(features: &BTreeMap>) -> String {
From 4f21fa2bda3ad61ac82a910c8596183a223d0900 Mon Sep 17 00:00:00 2001
From: Ginger
Date: Mon, 12 Oct 2026 11:12:49 -0400
Subject: [PATCH 003/342] refactor: Clean up join rule evaluation logic
---
src/api/server/make_join.rs | 248 +++++-------------
src/api/server/send_join.rs | 56 +++-
src/service/antispam/mod.rs | 32 ++-
src/service/rooms/membership/mod.rs | 388 +++++++++++++---------------
4 files changed, 314 insertions(+), 410 deletions(-)
diff --git a/src/api/server/make_join.rs b/src/api/server/make_join.rs
index 411a322f5..f9776933c 100644
--- a/src/api/server/make_join.rs
+++ b/src/api/server/make_join.rs
@@ -1,29 +1,19 @@
-use std::{borrow::ToOwned, pin::pin};
-
use axum::extract::State;
-use conduwuit::{
- Err, Error, Result, debug, debug_info, info, matrix::pdu::PartialPdu, utils, warn,
-};
-use conduwuit_service::Services;
-use futures::StreamExt;
+use conduwuit::{Err, Error, Result, info, matrix::pdu::PartialPdu, utils};
use ruma::{
- OwnedUserId, RoomId, UserId,
+ OwnedUserId,
api::{
error::{ErrorKind, IncompatibleRoomVersionErrorData},
federation::membership::prepare_join_event,
},
assign,
- events::{
- StateEventType,
- room::{
- join_rules::{AllowRule, JoinRule, RoomJoinRulesEventContent},
- member::{MembershipState, RoomMemberEventContent},
- },
+ events::room::{
+ join_rules::JoinRule,
+ member::{MembershipState, RoomMemberEventContent},
},
};
use serde_json::value::to_raw_value;
-use service::rooms::state::RoomMutexGuard;
-use tokio::join;
+use service::rooms::membership::JoinConditionResult;
use crate::Ruma;
@@ -35,9 +25,6 @@ pub(crate) async fn create_join_event_template_route(
State(services): State,
body: Ruma,
) -> Result {
- if !services.rooms.metadata.exists(&body.room_id).await {
- return Err!(Request(NotFound("Room is unknown to this server.")));
- }
if !services
.rooms
.state_cache
@@ -63,18 +50,6 @@ pub(crate) async fn create_join_event_template_route(
.acl_check(&body.identity, &body.room_id)
.await?;
- if services
- .moderation
- .is_remote_server_forbidden(&body.identity)
- {
- warn!(
- "Server {} for remote user {} tried joining room ID {} which has a server name that \
- is globally forbidden. Rejecting.",
- body.identity, &body.user_id, &body.room_id,
- );
- return Err!(Request(Forbidden("Server is banned on this homeserver.")));
- }
-
let room_version = services.rooms.state.get_room_version(&body.room_id).await?;
let room_version_rules = room_version.rules().unwrap();
if !body.ver.contains(&room_version) {
@@ -87,41 +62,74 @@ pub(crate) async fn create_join_event_template_route(
}
let state_lock = services.rooms.state.mutex.lock(body.room_id.as_str()).await;
- let (is_invited, is_joined) = join!(
- services
- .rooms
- .state_cache
- .is_invited(&body.user_id, &body.room_id),
- services
- .rooms
- .state_cache
- .is_joined(&body.user_id, &body.room_id)
- );
+
+ let current_membership = services
+ .rooms
+ .state_accessor
+ .get_member(&body.room_id, &body.user_id)
+ .await
+ .ok()
+ .map_or_else(|| MembershipState::Leave, |content| content.membership);
+
let join_authorized_via_users_server: Option = {
- if is_joined || is_invited {
- // User is already joined or invited and consequently does not need
- // an authorising user
+ if matches!(
+ current_membership,
+ MembershipState::Join | MembershipState::Invite | MembershipState::Knock
+ ) {
+ // User is already joined, invited, or knocked, and consequently
+ // does not need an authorising user
None
} else if !room_version_rules.authorization.restricted_join_rule {
- // room version does not support restricted join rules
+ // Room version does not support restricted join rules
None
- } else if user_can_perform_restricted_join(&services, &body.user_id, &body.room_id)
- .await?
- {
- Some(
- select_authorising_user(&services, &body.room_id, &body.user_id, &state_lock)
- .await?,
- )
} else {
- None
+ let join_rules = services
+ .rooms
+ .state_accessor
+ .get_join_rules(&body.room_id)
+ .await;
+
+ if let JoinRule::Restricted(conditions) | JoinRule::KnockRestricted(conditions) =
+ join_rules
+ {
+ match services
+ .rooms
+ .membership
+ .evaluate_join_conditions(&body.room_id, &body.user_id, &conditions)
+ .await
+ {
+ | JoinConditionResult::Satisfied => {
+ // Try to find an authorizing user
+ services
+ .rooms
+ .membership
+ .select_authorizing_user(&body.room_id, &body.user_id, &state_lock)
+ .await
+ .map(Some)?
+ },
+ | JoinConditionResult::Unsatisfied => {
+ return Err!(Request(Forbidden(
+ "You do not satisfy this room's join conditions."
+ )));
+ },
+ | JoinConditionResult::UnableToAuthorizeJoin => {
+ return Err!(Request(UnableToAuthorizeJoin(
+ "This server cannot check this room's join conditions."
+ )));
+ },
+ }
+ } else {
+ None
+ }
}
};
- if services.antispam.check_all_joins() && join_authorized_via_users_server.is_none() {
+
+ if services.antispam.check_all_joins() {
if services
.antispam
.meowlnir_accept_make_join(body.room_id.clone(), body.user_id.clone())
.await
- .is_err()
+ != JoinConditionResult::Satisfied
{
return Err!(Request(Forbidden("Antispam rejected join request.")));
}
@@ -153,133 +161,3 @@ pub(crate) async fn create_join_event_template_route(
}),
)
}
-
-/// Attempts to find a user who is able to issue an invite in the target room.
-pub(crate) async fn select_authorising_user<'a>(
- services: &Services,
- room_id: &'a RoomId,
- user_id: &'a UserId,
- state_lock: &'a RoomMutexGuard,
-) -> Result {
- let candidates = services.rooms.state_cache.local_users_in_room(room_id);
-
- let mut candidates = pin!(candidates);
-
- while let Some(candidate) = candidates.next().await {
- if services
- .rooms
- .state_accessor
- .user_can_invite(room_id, &candidate, user_id, state_lock)
- .await
- {
- return Ok(candidate);
- }
- }
-
- Err!(Request(UnableToGrantJoin(
- "No user on this server is able to assist in joining."
- )))
-}
-
-/// Checks whether the given user can join the given room via a restricted join.
-pub(crate) async fn user_can_perform_restricted_join(
- services: &Services,
- user_id: &UserId,
- room_id: &RoomId,
-) -> Result {
- let Ok(join_rules_event_content) = services
- .rooms
- .state_accessor
- .room_state_get_content::(
- room_id,
- &StateEventType::RoomJoinRules,
- "",
- )
- .await
- else {
- // No join rules means there's nothing to authorise (defaults to invite)
- return Ok(false);
- };
-
- let (JoinRule::Restricted(r) | JoinRule::KnockRestricted(r)) =
- join_rules_event_content.join_rule
- else {
- // This is not a restricted room
- return Ok(false);
- };
-
- if r.allow.is_empty() {
- // This will never be authorisable, return forbidden.
- return Err!(Request(Forbidden("You are not invited to this room.")));
- }
-
- let mut could_satisfy = true;
- for allow_rule in &r.allow {
- match allow_rule {
- | AllowRule::RoomMembership(membership) => {
- if !services
- .rooms
- .state_cache
- .server_in_room(services.globals.server_name(), &membership.room_id)
- .await
- {
- // Since we can't check this room, mark could_satisfy as
- // false so that we can return
- // M_UNABLE_TO_AUTHORIZE_JOIN later.
- could_satisfy = false;
- continue;
- }
-
- if services
- .rooms
- .state_cache
- .is_joined(user_id, &membership.room_id)
- .await
- {
- debug!(
- "User {} is allowed to join room {} via membership in room {}",
- user_id, room_id, membership.room_id
- );
- return Ok(true);
- }
- },
- | other if other.rule_type() == "fi.mau.spam_checker" =>
- return match services
- .antispam
- .meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
- .await
- {
- | Ok(()) => Ok(true),
- | Err(_) => Err!(Request(Forbidden("Antispam rejected join request."))),
- },
- | _ => {
- // We don't recognise this join rule, so we cannot satisfy the
- // request.
- could_satisfy = false;
- debug_info!(
- "Unsupported allow rule in restricted join for room {}: {:?}",
- room_id,
- allow_rule
- );
- },
- }
- }
-
- if could_satisfy {
- // We were able to check all the restrictions and can be certain that
- // the prospective member is not permitted to join.
- Err!(Request(Forbidden(
- "You do not belong to any of the rooms or spaces required to join this room."
- )))
- } else {
- // We were unable to check all the restrictions. This usually means we
- // aren't in one of the rooms this one is restricted to, ergo can't
- // check its state for the user's membership, and consequently the
- // user *might* be able to join if they ask another server.
- Err!(Request(UnableToAuthorizeJoin(
- "You do not belong to any of the recognised rooms or spaces required to join this \
- room, but this server is unable to verify every requirement. You may be able to \
- join via another server."
- )))
- }
-}
diff --git a/src/api/server/send_join.rs b/src/api/server/send_join.rs
index dd9b12e14..aa91957d0 100644
--- a/src/api/server/send_join.rs
+++ b/src/api/server/send_join.rs
@@ -16,9 +16,11 @@ use ruma::{
TimelineEventType,
room::member::{MembershipState, RoomMemberEventContent},
},
+ room::JoinRule,
room_version_rules::RoomVersionRules,
};
use serde_json::value::to_raw_value;
+use service::rooms::membership::JoinConditionResult;
use crate::{Ruma, server::utils::validate_any_membership_event};
@@ -108,18 +110,52 @@ async fn create_join_event(
they cannot authorise your join."
)));
}
- if !super::user_can_perform_restricted_join(services, &sender, room_id).await? {
- return Err!(Request(UnableToAuthorizeJoin(
- "Joining user did not pass restricted room's rules."
+
+ // If the user is invited or joined we don't need to check the join
+ // conditions, but in that case the requesting server shouldn't
+ // have set `join_authorized_via_users_server` in the first place.
+
+ let join_rules = services.rooms.state_accessor.get_join_rules(room_id).await;
+
+ if let JoinRule::Restricted(conditions) | JoinRule::KnockRestricted(conditions) =
+ join_rules
+ {
+ match services
+ .rooms
+ .membership
+ .evaluate_join_conditions(room_id, &sender, &conditions)
+ .await
+ {
+ | JoinConditionResult::Satisfied => {
+ // Sign the join to prove that we checked the conditions.
+
+ services
+ .server_keys
+ .hash_and_sign_event(&mut pdu, room_version_rules)
+ .map_err(|e| {
+ err!(Request(InvalidParam(warn!(
+ "Failed to sign send_join event: {e}"
+ ))))
+ })?;
+ },
+ | JoinConditionResult::Unsatisfied => {
+ return Err!(Request(Forbidden(
+ "You do not satisfy this room's join conditions."
+ )));
+ },
+ | JoinConditionResult::UnableToAuthorizeJoin => {
+ return Err!(Request(UnableToAuthorizeJoin(
+ "This server cannot check this room's join conditions."
+ )));
+ },
+ }
+ } else {
+ // We can't sign this, and if we don't sign it our event will fail
+ // the auth check, so we have to bail out here.
+ return Err!(Request(InvalidParam(
+ "join_authorized_via_users_server was supplied for a room that is not restricted"
)));
}
-
- services
- .server_keys
- .hash_and_sign_event(&mut pdu, room_version_rules)
- .map_err(|e| {
- err!(Request(InvalidParam(warn!("Failed to sign send_join event: {e}"))))
- })?;
}
let mutex_lock = services
diff --git a/src/service/antispam/mod.rs b/src/service/antispam/mod.rs
index 3e235e264..93eda539b 100644
--- a/src/service/antispam/mod.rs
+++ b/src/service/antispam/mod.rs
@@ -8,7 +8,7 @@ use ruma::{
};
use ruminuwuity::{draupnir_antispam, meowlnir_antispam};
-use crate::{client, config, sending, service::Dep};
+use crate::{client, config, rooms::membership::JoinConditionResult, sending, service::Dep};
struct Services {
server: Arc,
@@ -103,7 +103,7 @@ impl Service {
} else {
Ok(())
};
- self.record("user_may_invite", &result);
+ self.record("user_may_invite", if result.is_ok() { "allowed" } else { "denied" });
return result;
}
Ok(())
@@ -149,7 +149,7 @@ impl Service {
} else {
Ok(())
};
- self.record("user_may_join_room", &result);
+ self.record("user_may_join_room", if result.is_ok() { "allowed" } else { "denied" });
return result;
}
Ok(())
@@ -161,10 +161,10 @@ impl Service {
&self,
room_id: OwnedRoomId,
user_id: OwnedUserId,
- ) -> Result<()> {
+ ) -> JoinConditionResult {
if let Some(Antispam { meowlnir: Some(meowlnir), .. }) = &self.services.config.antispam {
debug!(?room_id, ?user_id, "Asking meowlnir for accept_make_join");
- let result = self
+ match self
.send_antispam_request(
meowlnir.base_url.as_str(),
&meowlnir.secret,
@@ -175,18 +175,24 @@ impl Service {
),
)
.await
- .inspect(|_| debug!("meowlnir allowed the make_join"))
- .inspect_err(|e| debug!("meowlnir denied the make_join: {e:?}"))
- .map(|_| ());
- self.record("accept_make_join", &result);
- result
+ {
+ | Ok(_) => {
+ debug!("meowlnir allowed the make_join");
+ self.record("accept_make_join", "allowed");
+ JoinConditionResult::Satisfied
+ },
+ | Err(err) => {
+ debug!("meowlnir denied the make_join: {err:?}");
+ self.record("accept_make_join", "denied");
+ JoinConditionResult::Unsatisfied
+ },
+ }
} else {
- Ok(())
+ JoinConditionResult::UnableToAuthorizeJoin
}
}
- fn record(&self, check: &'static str, result: &Result) {
- let outcome = if result.is_ok() { "allowed" } else { "denied" };
+ fn record(&self, check: &'static str, outcome: &'static str) {
self.services
.server
.metrics
diff --git a/src/service/rooms/membership/mod.rs b/src/service/rooms/membership/mod.rs
index 2f9a926c5..b8a2ed299 100644
--- a/src/service/rooms/membership/mod.rs
+++ b/src/service/rooms/membership/mod.rs
@@ -2,7 +2,6 @@ use std::{collections::HashMap, iter::once, sync::Arc};
use conduwuit::{
Err, Event, Pdu, Result, Server, debug, debug_info, debug_warn, defer, err, error, info,
- is_true,
matrix::{
StateKey,
event::{gen_event_id, gen_event_id_canonical_json},
@@ -24,12 +23,9 @@ use ruma::{
canonical_json::to_canonical_value,
events::{
StateEventType, StaticEventContent,
- room::{
- join_rules::RoomJoinRulesEventContent,
- member::{MembershipState, RoomMemberEventContent},
- },
+ room::member::{MembershipState, RoomMemberEventContent},
},
- room::{AllowRule, JoinRule},
+ room::{AllowRule, JoinRule, Restricted, RoomMembership},
};
use crate::{
@@ -44,6 +40,18 @@ use crate::{
sending, server_keys, sync, users,
};
+#[derive(PartialEq, Eq)]
+pub enum JoinConditionResult {
+ /// The local server verified that the user satisfies at least one join
+ /// condition.
+ Satisfied,
+ /// The local server verified that the user does not satisfy any join
+ /// conditions.
+ Unsatisfied,
+ /// The local server could not check all join conditions.
+ UnableToAuthorizeJoin,
+}
+
pub struct Service {
services: Services,
}
@@ -110,16 +118,36 @@ impl Service {
) -> Result {
assert!(self.services.globals.user_is_local(sender_user), "user should be local");
+ let servers: Vec<_> = servers
+ .iter()
+ .filter(|server| !self.services.globals.server_is_ours(server))
+ .collect();
+
let state_lock = self.services.state.mutex.lock(room_id).await;
- if self
+ let server_in_room = self
.services
.state_cache
- .is_joined(sender_user, room_id)
- .await
- {
- debug_warn!("{sender_user} is already joined in {room_id}");
+ .server_in_room(self.services.globals.server_name(), room_id)
+ .await;
+
+ // Only check our known membership if we're already in the room.
+ // See: https://forgejo.ellis.link/continuwuation/continuwuity/issues/855
+ let current_membership = if server_in_room {
+ self.services
+ .state_accessor
+ .get_member(room_id, sender_user)
+ .await
+ .ok()
+ .map_or_else(|| MembershipState::Leave, |content| content.membership)
+ } else {
+ MembershipState::Leave
+ };
+
+ if current_membership == MembershipState::Join {
return Ok(room_id.to_owned());
+ } else if current_membership == MembershipState::Ban {
+ return Err!(Request(Forbidden("You are banned from this room.")));
}
if let Err(e) = self
@@ -137,31 +165,16 @@ impl Service {
{
warn!("Antispam prevented user {} from joining room {}: {}", sender_user, room_id, e);
return Err!(Request(Forbidden("You are not allowed to join this room.")));
- }
-
- let server_in_room = self
- .services
- .state_cache
- .server_in_room(self.services.globals.server_name(), room_id)
- .await;
-
- // Only check our known membership if we're already in the room.
- // See: https://forgejo.ellis.link/continuwuation/continuwuity/issues/855
- let membership = if server_in_room {
- self.services
- .state_accessor
- .get_member(room_id, sender_user)
+ } else if self.services.antispam.check_all_joins() {
+ if self
+ .services
+ .antispam
+ .meowlnir_accept_make_join(room_id.to_owned(), sender_user.to_owned())
.await
- } else {
- debug!("Ignoring local state for join {room_id}, we aren't in the room yet.");
- Ok(RoomMemberEventContent::new(MembershipState::Leave))
- };
-
- if let Ok(m) = membership {
- if m.membership == MembershipState::Ban {
- debug_warn!("{sender_user} is banned from {room_id} but attempted to join");
- // TODO: return reason
- return Err!(Request(Forbidden("You are banned from the room.")));
+ != JoinConditionResult::Satisfied
+ {
+ warn!("Antispam prevented user {} from joining room {}", sender_user, room_id);
+ return Err!(Request(Forbidden("Antispam rejected join request.")));
}
}
@@ -172,31 +185,38 @@ impl Service {
)));
}
- if self.services.antispam.check_all_joins() {
- if let Err(e) = self
- .services
- .antispam
- .meowlnir_accept_make_join(room_id.to_owned(), sender_user.to_owned())
+ if server_in_room {
+ // Try to join the room locally.
+ match self
+ .join_local_room(
+ sender_user,
+ room_id,
+ current_membership,
+ reason.clone(),
+ &state_lock,
+ )
+ .boxed()
.await
{
- warn!(
- "Antispam prevented user {} from joining room {}: {}",
- sender_user, room_id, e
- );
- return Err!(Request(Forbidden("Antispam rejected join request.")));
+ | Ok(()) => {
+ // We were able to authorize a local join.
+ info!("Joined room locally");
+ return Ok(room_id.to_owned());
+ },
+ | Err(err) => {
+ // We couldn't authorize a local join, probably because it's
+ // restricted and we couldn't satisfy
+ // the join rules ourselves.
+ info!(?err, "Failed to join room locally, trying over federation instead");
+ },
}
}
- if server_in_room {
- self.join_local_room(sender_user, room_id, reason, servers, state_lock)
- .boxed()
- .await?;
- } else {
- // Ask a remote server if we are not participating in this room
- self.join_remote_room(sender_user, room_id, reason, servers, state_lock)
- .boxed()
- .await?;
- }
+ // If we aren't participating in the room, or failed to join locally,
+ // try to join over federation.
+ self.join_remote_room(sender_user, room_id, reason, &servers, &state_lock)
+ .boxed()
+ .await?;
Ok(room_id.to_owned())
}
@@ -206,39 +226,39 @@ impl Service {
&self,
sender_user: &UserId,
room_id: &RoomId,
+ current_membership: MembershipState,
reason: Option,
- servers: &[OwnedServerName],
- state_lock: RoomMutexGuard,
+ state_lock: &RoomMutexGuard,
) -> Result {
info!("Joining room locally");
- let (room_version, join_rules, is_invited) = join!(
+ let (room_version, join_rules) = join!(
self.services.state.get_room_version(room_id),
self.services.state_accessor.get_join_rules(room_id),
- self.services.state_cache.is_invited(sender_user, room_id)
);
let room_version = room_version?;
let room_version_rules = room_version.rules().unwrap();
let mut auth_user: Option = None;
- if !is_invited
- && matches!(join_rules, JoinRule::Restricted(_) | JoinRule::KnockRestricted(_))
+
+ if !matches!(current_membership, MembershipState::Invite | MembershipState::Knock)
+ && let JoinRule::Restricted(conditions) | JoinRule::KnockRestricted(conditions) =
+ &join_rules
{
if room_version_rules.authorization.restricted_join_rule {
// This is a restricted room, check if we can complete the join
// requirements locally.
- let needs_auth_user = self
- .user_can_perform_restricted_join(sender_user, room_id)
- .await;
- if needs_auth_user.is_ok_and(is_true!()) {
- // If there was an error or the value is false, we'll try
- // joining over federation. Since it's Ok(true), we can
- // authorise this locally. If we can't select a local
- // user, this will remain None, the join will fail, and
- // we'll fall back to federation.
+ if self
+ .evaluate_join_conditions(room_id, sender_user, conditions)
+ .await
+ == JoinConditionResult::Satisfied
+ {
+ // Try to find an authorizing user. If we can't find one,
+ // the local join will fail to authorize and we'll fall back
+ // to federation.
auth_user = self
- .select_authorising_user(room_id, sender_user, &state_lock)
+ .select_authorizing_user(room_id, sender_user, state_lock)
.await
.ok();
}
@@ -251,54 +271,27 @@ impl Service {
content.reason.clone_from(&reason);
content.join_authorized_via_users_server = auth_user;
- // Try normal join first
- let Err(error) = self
- .services
+ self.services
.timeline
.build_and_append_pdu(
PartialPdu::state(sender_user.to_string(), &content),
sender_user,
Some(room_id),
- &state_lock,
+ state_lock,
)
- .await
- else {
- info!("Joined room locally");
- return Ok(());
- };
+ .await?;
- if servers.is_empty()
- || servers.len() == 1 && self.services.globals.server_is_ours(&servers[0])
- {
- if !self.services.metadata.exists(room_id).await {
- return Err!(Request(
- Unknown(
- "Room was not found locally and no servers were found to help us \
- discover it"
- ),
- NOT_FOUND
- ));
- }
-
- return Err(error);
- }
-
- info!(
- ?error,
- remote_servers = %servers.len(),
- "Could not join room locally, attempting remote join",
- );
- Box::pin(self.join_remote_room(sender_user, room_id, reason, servers, state_lock)).await
+ Ok(())
}
#[tracing::instrument(skip_all, fields(%sender_user, %room_id), name = "join_remote_room", level = "info")]
- pub async fn join_remote_room(
+ async fn join_remote_room(
&self,
sender_user: &UserId,
room_id: &RoomId,
reason: Option,
- servers: &[OwnedServerName],
- state_lock: RoomMutexGuard,
+ servers: &[&OwnedServerName],
+ state_lock: &RoomMutexGuard,
) -> Result {
// public so the admin command force-join-room-remotely works
info!("Joining {room_id} over federation.");
@@ -657,7 +650,7 @@ impl Service {
debug!("Forcing state for new room");
self.services
.state
- .force_state(room_id, statehash_before_join, added, removed, &state_lock)
+ .force_state(room_id, statehash_before_join, added, removed, state_lock)
.await?;
debug!("Updating joined counts for new room");
@@ -679,7 +672,7 @@ impl Service {
&parsed_join_pdu,
join_event,
once(parsed_join_pdu.event_id.as_ref()),
- &state_lock,
+ state_lock,
room_id,
)
.await?;
@@ -694,7 +687,7 @@ impl Service {
// exist
self.services
.state
- .set_room_state(room_id, statehash_after_join, &state_lock);
+ .set_room_state(room_id, statehash_after_join, state_lock);
if !resident_before {
// NOTE: We replace local extremities for this room if we were not a
// resident before. We might be doing a remote join to satisfy
@@ -704,7 +697,7 @@ impl Service {
info!("Replacing local forward extremities");
self.services
.state
- .set_forward_extremities(room_id, once(parsed_join_pdu.event_id()), &state_lock)
+ .set_forward_extremities(room_id, once(parsed_join_pdu.event_id()), state_lock)
.await;
}
drop(cork);
@@ -722,7 +715,7 @@ impl Service {
&self,
sender_user: &UserId,
room_id: &RoomId,
- servers: &[OwnedServerName],
+ servers: &[&OwnedServerName],
) -> Result<(federation::membership::prepare_join_event::v1::Response, OwnedServerName)> {
let mut make_join_counter: usize = 1;
@@ -762,7 +755,7 @@ impl Service {
warn!("make_join response from {remote_server} failed validation: {e}");
continue;
}
- return Ok((response, remote_server.clone()));
+ return Ok((response, (*remote_server).clone()));
},
| Err(e) => match e.kind() {
| ErrorKind::UnableToAuthorizeJoin => {
@@ -810,7 +803,7 @@ impl Service {
/// Attempts to find a user who is able to issue an invite in the target
/// room.
- pub async fn select_authorising_user<'a>(
+ pub async fn select_authorizing_user<'a>(
&self,
room_id: &'a RoomId,
user_id: &'a UserId,
@@ -838,108 +831,99 @@ impl Service {
/// Checks whether the given user can join the given room via a restricted
/// join.
- pub(crate) async fn user_can_perform_restricted_join(
+ pub async fn evaluate_join_conditions(
&self,
- user_id: &UserId,
room_id: &RoomId,
- ) -> Result {
- let Ok(join_rules_event_content) = self
- .services
- .state_accessor
- .room_state_get_content::(
- room_id,
- &StateEventType::RoomJoinRules,
- "",
- )
- .await
- else {
- // No join rules means there's nothing to authorise (defaults to
- // invite)
- return Ok(false);
- };
-
- let (JoinRule::Restricted(r) | JoinRule::KnockRestricted(r)) =
- join_rules_event_content.join_rule
- else {
- // This is not a restricted room
- return Ok(false);
- };
-
- if r.allow.is_empty() {
+ user_id: &UserId,
+ conditions: &Restricted,
+ ) -> JoinConditionResult {
+ if conditions.allow.is_empty() {
// This will never be authorisable, return forbidden.
- return Err!(Request(Forbidden("You are not invited to this room.")));
+ return JoinConditionResult::Unsatisfied;
}
- let mut could_satisfy = true;
- for allow_rule in &r.allow {
- match allow_rule {
- | AllowRule::RoomMembership(membership) => {
- if !self
- .services
- .state_cache
- .server_in_room(self.services.globals.server_name(), &membership.room_id)
- .await
- {
- // Since we can't check this room, mark could_satisfy as
- // false so that we can return
- // M_UNABLE_TO_AUTHORIZE_JOIN later.
- could_satisfy = false;
- continue;
- }
+ let mut unable_to_authorize = false;
- if self
- .services
- .state_cache
- .is_joined(user_id, &membership.room_id)
- .await
- {
- debug!(
- "User {} is allowed to join room {} via membership in room {}",
- user_id, room_id, membership.room_id
- );
- return Ok(true);
- }
+ for rule in &conditions.allow {
+ match self.evaluate_allow_rule(room_id, user_id, rule).await {
+ | JoinConditionResult::Satisfied => {
+ // This allow rule is satisfied, the user can join.
+ return JoinConditionResult::Satisfied;
},
- | other if other.rule_type() == "fi.mau.spam_checker" =>
- return match self
- .services
- .antispam
- .meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
- .await
- {
- | Ok(()) => Ok(true),
- | Err(_) => Err!(Request(Forbidden("Antispam rejected join request."))),
- },
- | _ => {
- // We don't recognise this join rule, so we cannot satisfy
- // the request.
- could_satisfy = false;
- debug_info!(
- "Unsupported allow rule in restricted join for room {}: {:?}",
- room_id,
- allow_rule
- );
+ | JoinConditionResult::Unsatisfied => {
+ // This allow rule is not satisfied, but the user might be
+ // able to join if they satisfy another
+ // rule. Keep checking.
+ continue;
+ },
+ | JoinConditionResult::UnableToAuthorizeJoin => {
+ // We couldn't check this allow rule, but the user might be
+ // able to join if they satisfy another
+ // rule. Keep checking.
+ unable_to_authorize = true;
+ continue;
},
}
}
- if could_satisfy {
- // We were able to check all the restrictions and can be certain
- // that the prospective member is not permitted to join.
- Err!(Request(Forbidden(
- "You do not belong to any of the rooms or spaces required to join this room."
- )))
+ if unable_to_authorize {
+ // We couldn't conclusively determine if the user satisfies some
+ // rules.
+ JoinConditionResult::UnableToAuthorizeJoin
} else {
- // We were unable to check all the restrictions. This usually means
- // we aren't in one of the rooms this one is restricted to, ergo
- // can't check its state for the user's membership, and
- // consequently the user *might* be able to join if
- // they ask another server.
- Err!(Request(UnableToAuthorizeJoin(
- "You do not belong to any of the recognised rooms or spaces required to join \
- this room, but this server is unable to verify every requirement. You may be \
- able to join via another server."
- )))
+ // We determined that the user does not satisfy any rules.
+ JoinConditionResult::Unsatisfied
+ }
+ }
+
+ async fn evaluate_allow_rule(
+ &self,
+ room_id: &RoomId,
+ user_id: &UserId,
+ rule: &AllowRule,
+ ) -> JoinConditionResult {
+ match rule {
+ | AllowRule::RoomMembership(RoomMembership { room_id: condition_room, .. }) => {
+ if self
+ .services
+ .state_cache
+ .server_in_room(self.services.globals.server_name(), condition_room)
+ .await
+ {
+ if self
+ .services
+ .state_cache
+ .is_joined(user_id, condition_room)
+ .await
+ {
+ debug!(
+ ?user_id,
+ ?room_id,
+ ?condition_room,
+ "User may join via membership in {condition_room}"
+ );
+ JoinConditionResult::Satisfied
+ } else {
+ JoinConditionResult::Unsatisfied
+ }
+ } else {
+ JoinConditionResult::UnableToAuthorizeJoin
+ }
+ },
+ | other if other.rule_type() == "fi.mau.spam_checker" =>
+ self.services
+ .antispam
+ .meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
+ .await,
+ | unknown => {
+ debug!(
+ ?user_id,
+ ?room_id,
+ rule_type = unknown.rule_type(),
+ "Could not check unknown allow rule"
+ );
+ JoinConditionResult::UnableToAuthorizeJoin
+ },
}
}
}
From e6ca06a501ac3601b0bbe3a1f26c18cbc0798b49 Mon Sep 17 00:00:00 2001
From: Ginger
Date: Mon, 12 Oct 2026 14:13:15 -0400
Subject: [PATCH 004/342] feat: Add support for MSC4560
---
Cargo.lock | 22 +-
Cargo.toml | 5 +-
changelog.d/+01d550e6.feature.md | 3 +
src/api/client/room/mod.rs | 5 +-
src/api/client/room/stripped_state.rs | 71 ++++++
src/api/client/room/summary.rs | 9 +-
src/api/router.rs | 2 +
src/api/server/make_join.rs | 8 +-
src/api/server/mod.rs | 2 +
src/api/server/send_join.rs | 8 +-
src/api/server/stripped_state.rs | 54 +++++
src/core/matrix/versions.rs | 2 +
src/service/rooms/membership/mod.rs | 68 ++++--
src/service/rooms/summary/mod.rs | 326 +++++++++++++++++++-------
14 files changed, 460 insertions(+), 125 deletions(-)
create mode 100644 changelog.d/+01d550e6.feature.md
create mode 100644 src/api/client/room/stripped_state.rs
create mode 100644 src/api/server/stripped_state.rs
diff --git a/Cargo.lock b/Cargo.lock
index deac9fff4..6d72cea40 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5019,7 +5019,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.17.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"assign",
"js_int",
@@ -5038,7 +5038,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.17.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"http",
"js_int",
@@ -5051,7 +5051,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.25.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"as_variant",
"assign",
@@ -5073,7 +5073,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.20.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"as_variant",
"base64 0.23.1",
@@ -5106,7 +5106,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.35.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"as_variant",
"indexmap 2.14.2",
@@ -5127,7 +5127,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.16.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"bytes",
"http",
@@ -5149,7 +5149,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.12.1"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"js_int",
"thiserror 2.0.21",
@@ -5158,7 +5158,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.20.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"as_variant",
"cfg-if",
@@ -5174,7 +5174,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.16.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"js_int",
"ruma-common",
@@ -5186,7 +5186,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.22.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"base64 0.23.1",
"ed25519-dalek 3.0.0",
@@ -5203,7 +5203,7 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.18.0"
-source = "git+https://github.com/ruma/ruma.git?rev=f5e5e1c885f598036fd4326c566e9d1928027d5d#f5e5e1c885f598036fd4326c566e9d1928027d5d"
+source = "git+https://github.com/gingershaped/ruwuma.git?rev=ef98d8d0b111f563fab960c3f696493979fba3a7#ef98d8d0b111f563fab960c3f696493979fba3a7"
dependencies = [
"js_int",
"ruma-common",
diff --git a/Cargo.toml b/Cargo.toml
index fc1b2ef88..c70d5de05 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -347,8 +347,8 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
-git = "https://github.com/ruma/ruma.git"
-rev = "f5e5e1c885f598036fd4326c566e9d1928027d5d"
+git = "https://github.com/gingershaped/ruwuma.git"
+rev = "ef98d8d0b111f563fab960c3f696493979fba3a7"
features = [
"appservice-api-c",
"client-api",
@@ -388,6 +388,7 @@ features = [
"unstable-msc4494",
"unstable-msc4484",
"unstable-msc4540",
+ "unstable-msc4560",
"unstable-extensible-events",
]
diff --git a/changelog.d/+01d550e6.feature.md b/changelog.d/+01d550e6.feature.md
new file mode 100644
index 000000000..bb9a865ac
--- /dev/null
+++ b/changelog.d/+01d550e6.feature.md
@@ -0,0 +1,3 @@
+Implemented unstable support for [MSC4560] (Stripped state requests over federation). Contributed by @ginger.
+
+[MSC4560]: https://github.com/matrix-org/matrix-spec-proposals/pull/4560
diff --git a/src/api/client/room/mod.rs b/src/api/client/room/mod.rs
index e249e18b6..1d3125d3e 100644
--- a/src/api/client/room/mod.rs
+++ b/src/api/client/room/mod.rs
@@ -2,11 +2,12 @@ mod aliases;
mod create;
mod event;
mod initial_sync;
+mod stripped_state;
mod summary;
mod upgrade;
pub(crate) use self::{
aliases::get_room_aliases_route, create::create_room_route, event::get_room_event_route,
- initial_sync::room_initial_sync_route, summary::get_room_summary,
- upgrade::upgrade_room_route,
+ initial_sync::room_initial_sync_route, stripped_state::get_stripped_state_route,
+ summary::get_room_summary, upgrade::upgrade_room_route,
};
diff --git a/src/api/client/room/stripped_state.rs b/src/api/client/room/stripped_state.rs
new file mode 100644
index 000000000..d30655721
--- /dev/null
+++ b/src/api/client/room/stripped_state.rs
@@ -0,0 +1,71 @@
+use axum::extract::State;
+use conduwuit::{Err, Result};
+use ruma::{
+ api::client::state::get_stripped_state, assign, events::ALLOWED_STRIPPED_STATE_EVENTS,
+};
+use service::rooms::summary::{Accessibility, RoomStrippedState};
+
+use crate::{Ruma, router::ClientIdentity};
+
+/// # `POST /_matrix/client/unstable/org.continuwuity.msc4560.stripped_state/{room_id_or_alias}` ([MSC4560])
+///
+/// Returns a room's stripped state.
+///
+/// [MSC4560]: https://github.com/matrix-org/matrix-spec-proposals/pull/4560
+#[tracing::instrument(skip_all, name = "stripped_state", level = "info")]
+pub(crate) async fn get_stripped_state_route(
+ State(services): State,
+ body: Ruma,
+) -> Result {
+ let user_id = body.identity.as_ref().and_then(ClientIdentity::sender_user);
+
+ if body.via.len() > get_stripped_state::unstable::MAX_VIAS {
+ return Err!(Request(TooLarge("Too many vias, please be less indecisive.")));
+ }
+
+ if let Some(forbidden_type) = body
+ .state
+ .iter()
+ .find(|event_type| !ALLOWED_STRIPPED_STATE_EVENTS.contains(event_type))
+ {
+ return Err!(Request(InvalidParam(
+ "Event type {forbidden_type} may not be requested as stripped state."
+ )));
+ }
+
+ let (room_id, _) = services
+ .rooms
+ .alias
+ .resolve_with_servers(&body.room_id_or_alias, Some(body.via.clone()))
+ .await?;
+
+ if services.rooms.metadata.is_banned(&room_id).await {
+ return Err!(Request(Forbidden("This room is banned on this homeserver.")));
+ }
+
+ match services
+ .rooms
+ .summary
+ .get_stripped_state_for_user(
+ user_id,
+ &room_id,
+ &body.via,
+ &body.state,
+ body.num_joined_members,
+ )
+ .await
+ {
+ | Accessibility::Accessible((
+ via,
+ RoomStrippedState { state, num_joined_members, .. },
+ )) => Ok(
+ assign!(get_stripped_state::unstable::Response::new(via), { state, num_joined_members }),
+ ),
+ | Accessibility::Inaccessible => {
+ Err!(Request(Forbidden("You may not request this room's stripped state.")))
+ },
+ | Accessibility::NotFound => {
+ Err!(Request(NotFound("This room does not exist.")))
+ },
+ }
+}
diff --git a/src/api/client/room/summary.rs b/src/api/client/room/summary.rs
index da6958242..836dba890 100644
--- a/src/api/client/room/summary.rs
+++ b/src/api/client/room/summary.rs
@@ -13,7 +13,7 @@ pub(crate) async fn get_room_summary(
State(services): State,
body: Ruma,
) -> Result {
- let (room_id, servers) = services
+ let (room_id, _) = services
.rooms
.alias
.resolve_with_servers(&body.room_id_or_alias, Some(body.via.clone()))
@@ -27,12 +27,9 @@ pub(crate) async fn get_room_summary(
.rooms
.summary
.get_room_summary_for_user(
- body.identity
- .as_ref()
- .map(ClientIdentity::expect_sender_user)
- .transpose()?,
+ body.identity.as_ref().and_then(ClientIdentity::sender_user),
&room_id,
- &servers,
+ &body.via,
)
.await?;
diff --git a/src/api/router.rs b/src/api/router.rs
index 5fbe21134..09681c0b1 100644
--- a/src/api/router.rs
+++ b/src/api/router.rs
@@ -184,6 +184,7 @@ pub fn build(router: Router, state: State) -> Router {
.ruma_route(&client::get_mutual_rooms_unstable_route)
.ruma_route(&client::get_mutual_rooms_route)
.ruma_route(&client::get_room_summary)
+ .ruma_route(&client::get_stripped_state_route)
.ruma_route(&client::get_suspended_status)
.ruma_route(&client::put_suspended_status)
.ruma_route(&client::get_lock_status)
@@ -229,6 +230,7 @@ pub fn build(router: Router, state: State) -> Router {
.ruma_route(&server::get_keys_route)
.ruma_route(&server::claim_keys_route)
.ruma_route(&server::get_hierarchy_route)
+ .ruma_route(&server::get_stripped_state_route)
.ruma_route(&server::well_known_server)
.ruma_route(&server::get_content_route)
.ruma_route(&server::get_content_thumbnail_route)
diff --git a/src/api/server/make_join.rs b/src/api/server/make_join.rs
index f9776933c..dcb74d433 100644
--- a/src/api/server/make_join.rs
+++ b/src/api/server/make_join.rs
@@ -13,7 +13,7 @@ use ruma::{
},
};
use serde_json::value::to_raw_value;
-use service::rooms::membership::JoinConditionResult;
+use service::rooms::membership::{JoinConditionEntity, JoinConditionResult};
use crate::Ruma;
@@ -95,7 +95,11 @@ pub(crate) async fn create_join_event_template_route(
match services
.rooms
.membership
- .evaluate_join_conditions(&body.room_id, &body.user_id, &conditions)
+ .evaluate_join_conditions(
+ &body.room_id,
+ JoinConditionEntity::User(&body.user_id),
+ &conditions,
+ )
.await
{
| JoinConditionResult::Satisfied => {
diff --git a/src/api/server/mod.rs b/src/api/server/mod.rs
index 5c1ff3f79..b115ccabb 100644
--- a/src/api/server/mod.rs
+++ b/src/api/server/mod.rs
@@ -18,6 +18,7 @@ pub(super) mod send_knock;
pub(super) mod send_leave;
pub(super) mod state;
pub(super) mod state_ids;
+pub(super) mod stripped_state;
pub(super) mod user;
pub(super) mod version;
pub(super) mod well_known;
@@ -42,6 +43,7 @@ pub(super) use send_knock::*;
pub(super) use send_leave::*;
pub(super) use state::*;
pub(super) use state_ids::*;
+pub(super) use stripped_state::*;
pub(super) use user::*;
pub(super) use version::*;
pub(super) use well_known::*;
diff --git a/src/api/server/send_join.rs b/src/api/server/send_join.rs
index aa91957d0..d25fd8156 100644
--- a/src/api/server/send_join.rs
+++ b/src/api/server/send_join.rs
@@ -20,7 +20,7 @@ use ruma::{
room_version_rules::RoomVersionRules,
};
use serde_json::value::to_raw_value;
-use service::rooms::membership::JoinConditionResult;
+use service::rooms::membership::{JoinConditionEntity, JoinConditionResult};
use crate::{Ruma, server::utils::validate_any_membership_event};
@@ -123,7 +123,11 @@ async fn create_join_event(
match services
.rooms
.membership
- .evaluate_join_conditions(room_id, &sender, &conditions)
+ .evaluate_join_conditions(
+ room_id,
+ JoinConditionEntity::User(&sender),
+ &conditions,
+ )
.await
{
| JoinConditionResult::Satisfied => {
diff --git a/src/api/server/stripped_state.rs b/src/api/server/stripped_state.rs
new file mode 100644
index 000000000..9680583ce
--- /dev/null
+++ b/src/api/server/stripped_state.rs
@@ -0,0 +1,54 @@
+use axum::extract::State;
+use conduwuit::{Err, Result};
+use ruma::{
+ api::federation::event::get_stripped_state, assign, events::ALLOWED_STRIPPED_STATE_EVENTS,
+};
+use service::rooms::summary::{Accessibility, RoomStrippedState};
+
+use crate::Ruma;
+
+/// # `POST /_matrix/federation/unstable/org.continuwuity.msc4560.stripped_state/{room_id}` ([MSC4560])
+///
+/// Returns a room's stripped state.
+///
+/// [MSC4560]: https://github.com/matrix-org/matrix-spec-proposals/pull/4560
+pub(crate) async fn get_stripped_state_route(
+ State(services): State,
+ body: Ruma,
+) -> Result {
+ if let Some(forbidden_type) = body
+ .state
+ .iter()
+ .find(|event_type| !ALLOWED_STRIPPED_STATE_EVENTS.contains(event_type))
+ {
+ return Err!(Request(InvalidParam(
+ "Event type {forbidden_type} may not be requested as stripped state."
+ )));
+ }
+
+ if services.rooms.metadata.is_banned(&body.room_id).await {
+ return Err!(Request(Forbidden("This room is banned on this homeserver.")));
+ }
+
+ match services
+ .rooms
+ .summary
+ .get_local_stripped_state_for_server(
+ &body.identity,
+ &body.room_id,
+ &body.state,
+ body.num_joined_members,
+ )
+ .await
+ {
+ | Accessibility::Accessible(RoomStrippedState { state, num_joined_members, .. }) => Ok(
+ assign!(get_stripped_state::unstable::Response::default(), { state, num_joined_members }),
+ ),
+ | Accessibility::Inaccessible => {
+ Err!(Request(Forbidden("You may not access this room's stripped state.")))
+ },
+ | Accessibility::NotFound => {
+ Err!(Request(NotFound("This room is not known to this server.")))
+ },
+ }
+}
diff --git a/src/core/matrix/versions.rs b/src/core/matrix/versions.rs
index ae681e3ca..3ea538b62 100644
--- a/src/core/matrix/versions.rs
+++ b/src/core/matrix/versions.rs
@@ -50,5 +50,7 @@ pub fn unstable_features() -> BTreeMap {
("uk.timedout.msc4494".to_owned(), true),
// server administration OAuth scope (https://github.com/matrix-org/matrix-spec-proposals/pull/4484)
("org.continuwuity.msc4484.unstable".to_owned(), true),
+ // stripped state over federation (https://github.com/matrix-org/matrix-spec-proposals/pull/4560)
+ ("org.continuwuity.msc4560".to_owned(), true),
])
}
diff --git a/src/service/rooms/membership/mod.rs b/src/service/rooms/membership/mod.rs
index b8a2ed299..5445b15ac 100644
--- a/src/service/rooms/membership/mod.rs
+++ b/src/service/rooms/membership/mod.rs
@@ -15,7 +15,7 @@ use database::Database;
use futures::{FutureExt, StreamExt, TryFutureExt, join};
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId,
- RoomVersionId, UserId,
+ RoomVersionId, ServerName, UserId,
api::{
error::{ErrorKind, IncompatibleRoomVersionErrorData},
federation,
@@ -52,6 +52,20 @@ pub enum JoinConditionResult {
UnableToAuthorizeJoin,
}
+#[derive(Copy, Clone, Debug)]
+pub enum JoinConditionEntity<'id> {
+ User(&'id UserId),
+ Server(&'id ServerName),
+}
+
+impl<'id> From<&'id UserId> for JoinConditionEntity<'id> {
+ fn from(value: &'id UserId) -> Self { Self::User(value) }
+}
+
+impl<'id> From<&'id ServerName> for JoinConditionEntity<'id> {
+ fn from(value: &'id ServerName) -> Self { Self::Server(value) }
+}
+
pub struct Service {
services: Services,
}
@@ -250,7 +264,7 @@ impl Service {
// This is a restricted room, check if we can complete the join
// requirements locally.
if self
- .evaluate_join_conditions(room_id, sender_user, conditions)
+ .evaluate_join_conditions(room_id, sender_user.into(), conditions)
.await
== JoinConditionResult::Satisfied
{
@@ -834,7 +848,7 @@ impl Service {
pub async fn evaluate_join_conditions(
&self,
room_id: &RoomId,
- user_id: &UserId,
+ entity: JoinConditionEntity<'_>,
conditions: &Restricted,
) -> JoinConditionResult {
if conditions.allow.is_empty() {
@@ -845,7 +859,7 @@ impl Service {
let mut unable_to_authorize = false;
for rule in &conditions.allow {
- match self.evaluate_allow_rule(room_id, user_id, rule).await {
+ match self.evaluate_allow_rule(room_id, entity, rule).await {
| JoinConditionResult::Satisfied => {
// This allow rule is satisfied, the user can join.
return JoinConditionResult::Satisfied;
@@ -879,7 +893,7 @@ impl Service {
async fn evaluate_allow_rule(
&self,
room_id: &RoomId,
- user_id: &UserId,
+ entity: JoinConditionEntity<'_>,
rule: &AllowRule,
) -> JoinConditionResult {
match rule {
@@ -890,17 +904,25 @@ impl Service {
.server_in_room(self.services.globals.server_name(), condition_room)
.await
{
- if self
- .services
- .state_cache
- .is_joined(user_id, condition_room)
- .await
- {
+ let is_joined = match entity {
+ | JoinConditionEntity::User(user_id) =>
+ self.services
+ .state_cache
+ .is_joined(user_id, condition_room)
+ .await,
+ | JoinConditionEntity::Server(server) =>
+ self.services
+ .state_cache
+ .server_in_room(server, room_id)
+ .await,
+ };
+
+ if is_joined {
debug!(
- ?user_id,
+ ?entity,
?room_id,
?condition_room,
- "User may join via membership in {condition_room}"
+ "Entity may join via membership"
);
JoinConditionResult::Satisfied
} else {
@@ -910,14 +932,22 @@ impl Service {
JoinConditionResult::UnableToAuthorizeJoin
}
},
- | other if other.rule_type() == "fi.mau.spam_checker" =>
- self.services
- .antispam
- .meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
- .await,
+ | other if other.rule_type() == "fi.mau.spam_checker" => {
+ if let JoinConditionEntity::User(user_id) = entity {
+ self.services
+ .antispam
+ .meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
+ .await
+ } else {
+ // We can't currently check server names against the spam
+ // checker, so we just assume that they
+ // can't access the room for now.
+ JoinConditionResult::Unsatisfied
+ }
+ },
| unknown => {
debug!(
- ?user_id,
+ ?entity,
?room_id,
rule_type = unknown.rule_type(),
"Could not check unknown allow rule"
diff --git a/src/service/rooms/summary/mod.rs b/src/service/rooms/summary/mod.rs
index f2d56eb52..014e2fa57 100644
--- a/src/service/rooms/summary/mod.rs
+++ b/src/service/rooms/summary/mod.rs
@@ -1,4 +1,8 @@
-use std::{collections::HashSet, sync::Arc};
+use std::{
+ collections::{BTreeSet, HashSet},
+ pin::pin,
+ sync::Arc,
+};
use conduwuit::{
Err, Event, Result, debug, info,
@@ -10,18 +14,27 @@ use ruma::{
OwnedEventId, OwnedRoomId, OwnedServerName, RoomId, ServerName, UInt, UserId,
api::{
client::space::SpaceHierarchyRoomsChunk,
- federation::space::{SpaceHierarchyParentSummary, get_hierarchy},
+ error::ErrorKind,
+ federation::{
+ event::get_stripped_state,
+ space::{SpaceHierarchyParentSummary, get_hierarchy},
+ },
},
assign,
events::{
- StateEventType,
+ AnyStrippedStateEvent, StateEventType,
+ room::member::MembershipState,
space::child::{HierarchySpaceChildEvent, SpaceChildEventContent},
},
- room::{JoinRuleSummary, RestrictedSummary, RoomSummary, RoomType},
+ room::{JoinRule, RoomSummary, RoomType},
serde::Raw,
};
-use crate::{Dep, rooms, sending};
+use crate::{
+ Dep, globals,
+ rooms::{self, membership::JoinConditionResult},
+ sending,
+};
pub struct Service {
services: Services,
@@ -29,7 +42,8 @@ pub struct Service {
struct Services {
event_handler: Dep,
- metadata: Dep,
+ globals: Dep,
+ membership: Dep,
sending: Dep,
state: Dep,
state_accessor: Dep,
@@ -57,13 +71,21 @@ struct SpaceChild {
via: Vec,
}
+#[derive(Default)]
+#[non_exhaustive]
+pub struct RoomStrippedState {
+ pub state: Vec>,
+ pub num_joined_members: Option,
+}
+
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result> {
Ok(Arc::new(Self {
services: Services {
event_handler: args
.depend::("rooms::event_handler"),
- metadata: args.depend::("rooms::metadata"),
+ globals: args.depend::("globals"),
+ membership: args.depend::("rooms::membership"),
sending: args.depend::("sending"),
state: args.depend::("rooms::state"),
state_accessor: args
@@ -92,7 +114,7 @@ impl Service {
summary
} else if let Some((SpaceHierarchyParentSummary { summary, .. }, _)) =
- self.fetch_remote_summary(room_id, via, false).await?
+ self.fetch_remote_room_summary(room_id, via, false).await
{
// A via has this room.
@@ -105,7 +127,7 @@ impl Service {
};
// Check if the room is visible to the querying user.
- if !self.user_may_see_summary(querying_user, &summary).await {
+ if !self.user_may_see_summary(querying_user, room_id).await {
return Ok(Accessibility::Inaccessible);
}
@@ -138,8 +160,8 @@ impl Service {
SpaceHierarchyParentSummary { summary, children_state, .. },
inaccessible_children,
)) = self
- .fetch_remote_summary(room_id, via, suggested_only)
- .await?
+ .fetch_remote_room_summary(room_id, via, suggested_only)
+ .await
{
// A via has this room.
@@ -152,10 +174,7 @@ impl Service {
};
// Check if the room is visible to the querying user.
- if !self
- .user_may_see_summary(querying_user, &summary.summary)
- .await
- {
+ if !self.user_may_see_summary(querying_user, room_id).await {
return Ok(Accessibility::Inaccessible);
}
@@ -312,7 +331,7 @@ impl Service {
};
// Check if the server can see the root room's summary
- if !self.server_may_see_summary(querying_server, &summary).await {
+ if !self.server_may_see_summary(querying_server, room_id).await {
return Accessibility::Inaccessible;
}
@@ -331,7 +350,10 @@ impl Service {
.broad_then(async |child| {
let summary = {
if let Some(summary) = self.build_local_room_summary(&child.state_key).await {
- if self.server_may_see_summary(querying_server, &summary).await {
+ if self
+ .server_may_see_summary(querying_server, &child.state_key)
+ .await
+ {
Accessibility::Accessible(summary)
} else {
Accessibility::Inaccessible
@@ -439,20 +461,14 @@ impl Service {
}
/// Query remote servers for the summary of a room.
- async fn fetch_remote_summary(
+ async fn fetch_remote_room_summary(
&self,
room_id: &RoomId,
via: &[OwnedServerName],
suggested_only: bool,
- ) -> Result
From a13a50836b17e539c2fb4ae2b7210d6b6dbdf9ea Mon Sep 17 00:00:00 2001
From: Renovate Bot
Date: Sun, 25 Oct 2026 05:19:08 +0000
Subject: [PATCH 020/342] chore(deps): update rust-non-major
---
Cargo.lock | 219 ++++++++++++++++++++++++-----------------------------
1 file changed, 100 insertions(+), 119 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 4d0d21836..b005e5a29 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -208,7 +208,7 @@ dependencies = [
"rustc-hash",
"serde",
"serde_derive",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -270,7 +270,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -296,9 +296,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "aws-lc-rs"
-version = "1.18.1"
+version = "1.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b281d307588d634de920874890732659e2e7672f72b5e10e81badc1a8a83621e"
+checksum = "faac5829c2b74c28f830747e7818ccfb684261b5f48a1118b1e2a13d36dfab13"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -306,9 +306,9 @@ dependencies = [
[[package]]
name = "aws-lc-sys"
-version = "0.45.0"
+version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bff6c3b54fad79a2e60b8102caf565819711497c1f5f092f49508e2f5c31b27"
+checksum = "f1622d8446a2d4b2ce0c7eefc73dd43a99779028d5ee5c2dd8073a658ba8a2bc"
dependencies = [
"cc",
"cmake",
@@ -708,7 +708,7 @@ checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9"
dependencies = [
"semver",
"serde",
- "toml 1.1.6+spec-1.1.0",
+ "toml 1.1.8+spec-1.1.0",
]
[[package]]
@@ -828,7 +828,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -1076,7 +1076,7 @@ dependencies = [
"tikv-jemallocator",
"tokio",
"tokio-metrics",
- "toml 1.1.6+spec-1.1.0",
+ "toml 1.1.8+spec-1.1.0",
"tracing",
"tracing-core",
"tracing-subscriber",
@@ -1111,7 +1111,7 @@ dependencies = [
"itertools 0.15.0",
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -1668,7 +1668,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -1690,7 +1690,7 @@ checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"
dependencies = [
"darling_core 0.24.1",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -1840,7 +1840,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -1949,9 +1949,9 @@ dependencies = [
[[package]]
name = "either"
-version = "1.18.0"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
+checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
dependencies = [
"serde",
]
@@ -2175,16 +2175,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
-[[package]]
-name = "futf"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843"
-dependencies = [
- "mac",
- "new_debug_unreachable",
-]
-
[[package]]
name = "futures"
version = "0.3.34"
@@ -2241,7 +2231,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -2653,16 +2643,12 @@ dependencies = [
[[package]]
name = "html5ever"
-version = "0.27.0"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4"
+checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8"
dependencies = [
"log",
- "mac",
"markup5ever",
- "proc-macro2",
- "quote",
- "syn 2.0.119",
]
[[package]]
@@ -2736,9 +2722,9 @@ dependencies = [
[[package]]
name = "hyper"
-version = "1.11.1"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43"
+checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"
dependencies = [
"atomic-waker",
"bytes",
@@ -3428,12 +3414,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "mac"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
-
[[package]]
name = "maplit"
version = "1.0.2"
@@ -3442,23 +3422,20 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "markup5ever"
-version = "0.12.1"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45"
+checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de"
dependencies = [
"log",
- "phf",
- "phf_codegen",
- "string_cache",
- "string_cache_codegen",
"tendril",
+ "web_atoms",
]
[[package]]
name = "markup5ever_rcdom"
-version = "0.3.0"
+version = "0.39.0+unofficial"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18"
+checksum = "3ac010f19d6c4af81eeb4018a39d7a115de9d285af45c126a4ac02e6fc5716b7"
dependencies = [
"html5ever",
"markup5ever",
@@ -3522,9 +3499,9 @@ dependencies = [
[[package]]
name = "minicbor"
-version = "2.3.0"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c12b4033ffaa92fbf9df03df38d19324f52bad130dd223f811734a8006dd2d69"
+checksum = "e7244eafd1e09e7c4e33043881997aa6ab6dffff3ed2cee3395a278980481d6e"
[[package]]
name = "minicbor-serde"
@@ -3628,7 +3605,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -3812,7 +3789,7 @@ version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d"
dependencies = [
- "base64 0.22.1",
+ "base64 0.21.7",
"chrono",
"getrandom 0.2.17",
"http",
@@ -4318,18 +4295,19 @@ dependencies = [
[[package]]
name = "phf"
-version = "0.11.3"
+version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
+checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
dependencies = [
"phf_shared",
+ "serde",
]
[[package]]
name = "phf_codegen"
-version = "0.11.3"
+version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
+checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
dependencies = [
"phf_generator",
"phf_shared",
@@ -4337,19 +4315,19 @@ dependencies = [
[[package]]
name = "phf_generator"
-version = "0.11.3"
+version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
+checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
dependencies = [
+ "fastrand",
"phf_shared",
- "rand 0.8.8",
]
[[package]]
name = "phf_shared"
-version = "0.11.3"
+version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
+checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
dependencies = [
"siphasher",
]
@@ -4535,7 +4513,7 @@ dependencies = [
"proc-macro-error-attr3",
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -4832,7 +4810,7 @@ checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -4957,11 +4935,10 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7"
[[package]]
name = "resolvematrix"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f072176a8b0cbe7c3df2281991ef00a09889d8ec789f2878e7fee43a3b978a6f"
+checksum = "9e7767f4eb1d58880d6b33135a6c098cc8fbccecb259a833b44448c0de144dac"
dependencies = [
- "futures",
"hickory-resolver",
"num-traits",
"parking_lot",
@@ -4969,6 +4946,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror 2.0.21",
+ "tokio-stream",
"tracing",
]
@@ -5167,8 +5145,8 @@ dependencies = [
"quote",
"ruma-identifiers-validation",
"serde",
- "syn 3.0.6",
- "toml 1.1.6+spec-1.1.0",
+ "syn 3.0.9",
+ "toml 1.1.8+spec-1.1.0",
]
[[package]]
@@ -5654,7 +5632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8050abb251097357e24aff63ba2c52a6309ecb7d23a5474023df960a02694d8"
dependencies = [
"annotate-snippets",
- "base64 0.23.1",
+ "base64 0.21.7",
"encoding_rs_io",
"granit-parser",
"nohash-hasher",
@@ -5691,7 +5669,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -5709,9 +5687,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.151"
+version = "1.0.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
dependencies = [
"itoa",
"memchr",
@@ -5761,9 +5739,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "1.1.1"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
@@ -5810,7 +5788,7 @@ dependencies = [
"darling 0.24.1",
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -5984,9 +5962,9 @@ dependencies = [
[[package]]
name = "smallvec"
-version = "1.16.1"
+version = "1.16.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
+checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
dependencies = [
"serde",
]
@@ -6050,9 +6028,9 @@ checksum = "f42444fea5b87a39db4218d9422087e66a85d0e7a0963a439b07bcdf91804006"
[[package]]
name = "string_cache"
-version = "0.8.9"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f"
+checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901"
dependencies = [
"new_debug_unreachable",
"parking_lot",
@@ -6063,9 +6041,9 @@ dependencies = [
[[package]]
name = "string_cache_codegen"
-version = "0.5.4"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0"
+checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69"
dependencies = [
"phf_generator",
"phf_shared",
@@ -6098,9 +6076,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "3.0.6"
+version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
+checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
dependencies = [
"proc-macro2",
"quote",
@@ -6156,13 +6134,11 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]]
name = "tendril"
-version = "0.4.3"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0"
+checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08"
dependencies = [
- "futf",
- "mac",
- "utf-8",
+ "new_debug_unreachable",
]
[[package]]
@@ -6228,7 +6204,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -6339,7 +6315,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
@@ -6403,14 +6379,14 @@ dependencies = [
[[package]]
name = "toml"
-version = "1.1.6+spec-1.1.0"
+version = "1.1.8+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a"
+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
dependencies = [
"indexmap 2.14.2",
"serde_core",
- "serde_spanned 1.1.1",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "serde_spanned 1.1.2",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
@@ -6427,9 +6403,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "1.1.1+spec-1.1.0"
+version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [
"serde_core",
]
@@ -6455,16 +6431,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
dependencies = [
"indexmap 2.14.2",
- "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"winnow 1.0.4",
]
[[package]]
name = "toml_parser"
-version = "1.1.3+spec-1.1.0"
+version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [
"winnow 1.0.4",
]
@@ -6477,9 +6453,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]
name = "toml_writer"
-version = "1.1.2+spec-1.1.0"
+version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "tonic"
@@ -6877,12 +6853,6 @@ version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
-[[package]]
-name = "utf-8"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-
[[package]]
name = "utf8_iter"
version = "1.0.4"
@@ -6959,9 +6929,9 @@ dependencies = [
[[package]]
name = "want"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"
dependencies = [
"try-lock",
]
@@ -7023,7 +6993,7 @@ dependencies = [
"bumpalo",
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
"wasm-bindgen-shared",
]
@@ -7084,10 +7054,22 @@ dependencies = [
]
[[package]]
-name = "webpage"
-version = "2.0.1"
+name = "web_atoms"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70862efc041d46e6bbaa82bb9c34ae0596d090e86cbd14bd9e93b36ee6802eac"
+checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3"
+dependencies = [
+ "phf",
+ "phf_codegen",
+ "string_cache",
+ "string_cache_codegen",
+]
+
+[[package]]
+name = "webpage"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5547a459b8cab203b5bf7d1f97855b3d6ae706da7c93773328614309432c9e4c"
dependencies = [
"html5ever",
"markup5ever_rcdom",
@@ -7127,9 +7109,9 @@ checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471"
[[package]]
name = "wildmatch"
-version = "2.6.1"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29333c3ea1ba8b17211763463ff24ee84e41c78224c16b001cd907e663a38c68"
+checksum = "f18219fbd41a807dec044965d4106bb4fdb1d3a4b70aac4e5510aacc80a9f140"
[[package]]
name = "winapi"
@@ -7346,12 +7328,11 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
[[package]]
name = "xml5ever"
-version = "0.18.1"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69"
+checksum = "5ab627f34ff61b80d756180d556f9c68801d836d271b3b8c094504ceca69d221"
dependencies = [
"log",
- "mac",
"markup5ever",
]
@@ -7471,7 +7452,7 @@ checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.6",
+ "syn 3.0.9",
]
[[package]]
From 0ad4fc1c25c0ceaf8a53964b12e3e6f661e652b3 Mon Sep 17 00:00:00 2001
From: Renovate Bot
Date: Sun, 25 Oct 2026 05:19:25 +0000
Subject: [PATCH 021/342] chore(deps): update dependency
cargo-bins/cargo-binstall to v1.26.1
---
docker/Dockerfile | 2 +-
docker/musl.Dockerfile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 1c32a245c..3f5b99ff6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -50,7 +50,7 @@ EOF
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
-ENV BINSTALL_VERSION=1.25.3
+ENV BINSTALL_VERSION=1.26.1
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
diff --git a/docker/musl.Dockerfile b/docker/musl.Dockerfile
index 80dacba77..a4f2978f6 100644
--- a/docker/musl.Dockerfile
+++ b/docker/musl.Dockerfile
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
-ENV BINSTALL_VERSION=1.25.3
+ENV BINSTALL_VERSION=1.26.1
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
From 263ccd6b0b127e0d68d6c509c1275038c03b9dfa Mon Sep 17 00:00:00 2001
From: Renovate Bot
Date: Mon, 19 Oct 2026 05:19:42 +0000
Subject: [PATCH 022/342] chore(deps): update rust-zerover-patch-updates
---
Cargo.lock | 65 +++++++++++++++++++++++-------------------------------
1 file changed, 28 insertions(+), 37 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index b005e5a29..b355dfeee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1067,7 +1067,7 @@ dependencies = [
"serde-saphyr",
"serde_json",
"serde_regex",
- "sha2 0.11.0",
+ "sha2 0.11.1",
"smallstr",
"smallvec",
"thiserror 2.0.21",
@@ -1194,7 +1194,7 @@ dependencies = [
"serde-saphyr",
"serde_json",
"serde_urlencoded",
- "sha2 0.11.0",
+ "sha2 0.11.1",
"termimad",
"tokio",
"tracing",
@@ -1941,7 +1941,7 @@ dependencies = [
"curve25519-dalek 5.0.0",
"ed25519 3.0.0",
"serde",
- "sha2 0.11.0",
+ "sha2 0.11.1",
"signature 3.0.0",
"subtle",
"zeroize",
@@ -3047,15 +3047,6 @@ dependencies = [
"either",
]
-[[package]]
-name = "itertools"
-version = "0.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
-dependencies = [
- "either",
-]
-
[[package]]
name = "itertools"
version = "0.15.0"
@@ -3287,9 +3278,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.189"
+version = "0.2.191"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "libloading"
@@ -3505,9 +3496,9 @@ checksum = "e7244eafd1e09e7c4e33043881997aa6ab6dffff3ed2cee3395a278980481d6e"
[[package]]
name = "minicbor-serde"
-version = "0.7.1"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7abdec9761edcb452764c68564ae4b77ec62f6c1a361aa68f5de15fd788c679"
+checksum = "b05ae1ca1d2c55196b389c8308119aa0e2aa8d31115f018dcc23ba3c5d350eb3"
dependencies = [
"minicbor",
"serde",
@@ -4026,9 +4017,9 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "opentelemetry"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cdb0b1b267eb9db3331b434ed9ddab10d50e280a9adf9d13e5233e2002b61b5"
+checksum = "8c1f1a6ac9c875a4941e4c7c085b61e8f4daa326de03b4701768c3491a6ad9ee"
dependencies = [
"futures-core",
"futures-sink",
@@ -4040,9 +4031,9 @@ dependencies = [
[[package]]
name = "opentelemetry-http"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee2c3625b8aa04209f7e01e513bc8044da9687fa38a9eacf59628ca5f3b87300"
+checksum = "302249bd8ee804789faaa7b5b2cbf79bc61cb864714079c644e3828af5b7e811"
dependencies = [
"async-trait",
"bytes",
@@ -4070,9 +4061,9 @@ dependencies = [
[[package]]
name = "opentelemetry-otlp"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "699a67345e21962a231955b9059a157e428b219fa5df8efe11f08346fb23a344"
+checksum = "0756af24841e367128ef31c831999937b8b5c5197d47914590d8f4e2e88c2e1a"
dependencies = [
"http",
"httpdate",
@@ -4090,9 +4081,9 @@ dependencies = [
[[package]]
name = "opentelemetry-prometheus"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "274c2e3a2ad55524484500d5a78dffbfee23e4a1e4c3d3fcbd881b61b033e6df"
+checksum = "b9b52a5722eb64d198d6b6f1189e6b75a3c5ddfd224f48ede00c4330e0f11c66"
dependencies = [
"once_cell",
"opentelemetry",
@@ -4103,9 +4094,9 @@ dependencies = [
[[package]]
name = "opentelemetry-proto"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25da1ac11a0aeccf38d7f77ee0348715adaf8340f65ad46c94a02c6b20e2f65d"
+checksum = "d576f5dddc3299341bcd85a04be17b2564844c0c9563214f02d85f2524d1afae"
dependencies = [
"opentelemetry",
"opentelemetry_sdk",
@@ -4116,15 +4107,15 @@ dependencies = [
[[package]]
name = "opentelemetry-semantic-conventions"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d288b1e1bc3590052fbb8f0f635ef248dd9022cf1fbaeb6582b7ad6081a17b87"
+checksum = "7a3cf639fefd3e852869114f9925b578da6dd8e99281a2089bb0e773ead46962"
[[package]]
name = "opentelemetry_sdk"
-version = "0.33.0"
+version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb39533d9d1c912123efd7d41d7e0c29d16917b60ce15b4c8d87cb1af7f67520"
+checksum = "372a912db2974d1990207006fd0e3aa0ef3fd4ad3be43c65cfaadf2206866061"
dependencies = [
"futures-channel",
"futures-executor",
@@ -4569,7 +4560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
dependencies = [
"anyhow",
- "itertools 0.14.0",
+ "itertools 0.10.5",
"proc-macro2",
"quote",
"syn 2.0.119",
@@ -5174,7 +5165,7 @@ dependencies = [
"ruma-common",
"ruma-events",
"serde_json",
- "sha2 0.11.0",
+ "sha2 0.11.1",
"thiserror 2.0.21",
]
@@ -5826,9 +5817,9 @@ dependencies = [
[[package]]
name = "sha2"
-version = "0.11.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4"
+checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
dependencies = [
"cfg-if",
"cpufeatures 0.3.1",
@@ -6143,9 +6134,9 @@ dependencies = [
[[package]]
name = "termimad"
-version = "0.35.4"
+version = "0.35.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2374179aac8b77011a1aefe2f44d0c34eb680c9b4bd1c369a88991262c60c85a"
+checksum = "092b11fb38404fa873f019f8e5f300fa5787f381b7a58b923546d94b5a9065fd"
dependencies = [
"coolor",
"crokey",
@@ -7030,7 +7021,7 @@ dependencies = [
"hkdf 0.13.0",
"http",
"p256",
- "sha2 0.11.0",
+ "sha2 0.11.1",
]
[[package]]
From ffef3911e76e04136ab772ff5644fa8e7b25701b Mon Sep 17 00:00:00 2001
From: Renovate Bot
Date: Mon, 19 Oct 2026 05:41:22 +0000
Subject: [PATCH 023/342] chore(deps): update rust crate loole to 0.6.0
---
Cargo.lock | 4 ++--
Cargo.toml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index b355dfeee..8b24ee354 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3372,9 +3372,9 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
[[package]]
name = "loole"
-version = "0.4.1"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a3932a13b27d6b2d37efec3e4047017d59a8c9f2283a29bde29151d22f00fe9"
+checksum = "45a6f2ee852ef619dac448846d7a80fb56a08e842674202d1ffe509fc319165c"
dependencies = [
"futures-core",
"futures-sink",
diff --git a/Cargo.toml b/Cargo.toml
index 7bce7584b..1508b5267 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -330,7 +330,7 @@ version = "2.1.1"
# used for MPSC channels
[workspace.dependencies.loole]
-version = "0.4.0"
+version = "0.6.0"
# used for MPMC channels
[workspace.dependencies.async-channel]
From 3295427af6de75b8a0a7347f29e71c7b340830e7 Mon Sep 17 00:00:00 2001
From: Ginger
Date: Sat, 24 Oct 2026 15:04:44 -0400
Subject: [PATCH 024/342] fix: Don't check room summary access rules on remote
rooms
---
changelog.d/+b5e913f8.bugfix.md | 1 +
src/service/rooms/summary/mod.rs | 47 ++++++++++++++++----------------
2 files changed, 25 insertions(+), 23 deletions(-)
create mode 100644 changelog.d/+b5e913f8.bugfix.md
diff --git a/changelog.d/+b5e913f8.bugfix.md b/changelog.d/+b5e913f8.bugfix.md
new file mode 100644
index 000000000..cea4cfece
--- /dev/null
+++ b/changelog.d/+b5e913f8.bugfix.md
@@ -0,0 +1 @@
+Room summary visibility checks are no longer incorrectly applied for remote rooms. Contributed by @ginger.
diff --git a/src/service/rooms/summary/mod.rs b/src/service/rooms/summary/mod.rs
index 4c2e21e86..42a277c17 100644
--- a/src/service/rooms/summary/mod.rs
+++ b/src/service/rooms/summary/mod.rs
@@ -112,6 +112,11 @@ impl Service {
if let Some(summary) = self.build_local_room_summary(room_id).await {
// We have this room locally.
+ // Check if the room is visible to the querying user.
+ if !self.user_may_see_summary(querying_user, room_id).await {
+ return Ok(Accessibility::Inaccessible);
+ }
+
summary
} else if let Some((SpaceHierarchyParentSummary { summary, .. }, _)) =
self.fetch_remote_room_summary(room_id, via, false).await
@@ -126,11 +131,6 @@ impl Service {
}
};
- // Check if the room is visible to the querying user.
- if !self.user_may_see_summary(querying_user, room_id).await {
- return Ok(Accessibility::Inaccessible);
- }
-
Ok(Accessibility::Accessible(summary))
}
@@ -146,10 +146,18 @@ impl Service {
via: Option<&[OwnedServerName]>,
suggested_only: bool,
) -> Result> {
- let (mut summary, inaccessible_children) = {
+ let (summary, inaccessible_children) = {
if let Some(summary) = self.build_local_room_summary(room_id).await {
// We have this room locally.
- let children_state = self.get_space_child_events(room_id, suggested_only).await;
+ if !self.user_may_see_summary(querying_user, room_id).await {
+ return Ok(Accessibility::Inaccessible);
+ }
+
+ let children_state = if matches!(summary.room_type, Some(RoomType::Space)) {
+ self.get_space_child_events(room_id, suggested_only).await
+ } else {
+ vec![]
+ };
// All of the room's children are accessible to this server
// (because we have the full room and its state), although
@@ -173,15 +181,6 @@ impl Service {
}
};
- // Check if the room is visible to the querying user.
- if !self.user_may_see_summary(querying_user, room_id).await {
- return Ok(Accessibility::Inaccessible);
- }
-
- if !matches!(summary.summary.room_type.as_ref(), Some(RoomType::Space)) {
- summary.children_state.clear();
- }
-
let mut children: Vec<_> = summary
.children_state
.iter()
@@ -301,11 +300,12 @@ impl Service {
summaries.push(summary.summary);
inaccessible_children.extend(summary.inaccessible_children);
- // Bail out if queue length exceeds 50 to keep cycles in the space
- // graph from blowing up the traversal. If you actually have over
- // fifty nested spaces, and you're looking at this function to
- // figure out what the issue is, I suggest you reconsider some of
- // the choices you made which led you to this point.
+ // Bail out if more than fifty rooms are queued to prevent a DOS
+ // when traversing incredibly large hierarchies. If you
+ // actually have over fifty nested rooms, and you're
+ // looking at this function to figure out what the issue
+ // is, I suggest you reconsider some of the choices you
+ // made which led you to this point.
if queue.len() > 50 {
return Err!(Request(TooLarge("Space hierarchy is unreasonably large")));
}
@@ -793,8 +793,9 @@ impl Service {
}
// Servers may always see summaries if any of their users are
- // participating in the room. It's the requesting server's job to
- // restrict visibility on a per-user basis.
+ // participating in the room. The server really should have generated a
+ // summary itself, instead of asking us for it, but we might as
+ // well save ourselves a bit of time checking the other rules.
if self
.services
.state_cache
From b848aed1bb8aa5f12579d73b1b7f71c7512222cb Mon Sep 17 00:00:00 2001
From: Ginger
Date: Sun, 25 Oct 2026 13:33:31 -0400
Subject: [PATCH 025/342] chore: Update git-blame-ignore-revs
---
.git-blame-ignore-revs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 74805ccd4..8c42d4f7b 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -7,6 +7,7 @@ f419c64aca300a338096b4e0db4c73ace54f23d0
5998a0d883d31b866f7c8c46433a8857eae51a89
# trailing whitespace and newlines
46c193e74b2ce86c48ce802333a0aabce37fd6e9
-# rustfmt update that rewrapped tons of comments
+# rustfmt updates that rewrapped tons of comments
9fbabe221051e6956a05d8824142092ede68971e
b0c0905472b882ff0cc79232e73d307fd0b5035b
+9c27441acf2e65f85c106ccff5c6b6c37030ddca
From 81c62c4a35aacca830c6268a96602537a9c22855 Mon Sep 17 00:00:00 2001
From: Ginger
Date: Sun, 25 Oct 2026 13:47:36 -0400
Subject: [PATCH 026/342] fix: Silence tower_sessions warning
---
src/web/session/store.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/web/session/store.rs b/src/web/session/store.rs
index a05adb6cd..c7e051dd2 100644
--- a/src/web/session/store.rs
+++ b/src/web/session/store.rs
@@ -32,6 +32,19 @@ impl SessionStore for RocksDbSessionStore {
Ok(())
}
+ async fn create(&self, session: &mut Record) -> Result<(), Error> {
+ while self
+ .websessionid_session
+ .exists(&session.id.0.to_be_bytes())
+ .await
+ .is_ok()
+ {
+ session.id = Id::default();
+ }
+
+ self.save(session).await
+ }
+
async fn load(&self, session_id: &Id) -> Result