1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-04-22 14:10:16 +03:00

Merge branch 'ruma-exhaustive-env-var' into 'next'

switch to env var for enabling ruma exhaustive types

See merge request 
This commit is contained in:
Matthias Ahouansou 2025-03-15 00:33:14 +00:00
commit 147161fda1
6 changed files with 26 additions and 41 deletions
.cargo
Cargo.lockCargo.toml
src/service/rooms
event_handler
helpers
timeline

View file

@ -1,2 +1,2 @@
[build]
rustflags = ["--cfg=ruma_unstable_exhaustive_types"]
[env]
RUMA_UNSTABLE_EXHAUSTIVE_TYPES = "1"

22
Cargo.lock generated
View file

@ -2190,7 +2190,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.12.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"assign",
"js_int",
@ -2209,7 +2209,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.12.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"js_int",
"ruma-common",
@ -2221,7 +2221,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.20.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"as_variant",
"assign",
@ -2244,7 +2244,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.15.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"as_variant",
"base64 0.22.1",
@ -2275,7 +2275,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.30.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"as_variant",
"indexmap 2.2.6",
@ -2298,7 +2298,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.11.0"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"bytes",
"headers",
@ -2320,7 +2320,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.10.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"js_int",
"thiserror 2.0.11",
@ -2329,7 +2329,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.15.1"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"cfg-if",
"proc-macro-crate",
@ -2344,7 +2344,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.11.0"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"js_int",
"ruma-common",
@ -2356,7 +2356,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.17.0"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
@ -2372,7 +2372,7 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.13.0"
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
dependencies = [
"js_int",
"ruma-common",

View file

@ -153,7 +153,6 @@ features = [
"compat-optional",
"compat-optional-txn-pdus",
"compat-server-signing-key-version",
"compat-signature-id",
"compat-tag-info",
"compat-unset-avatar",
"federation-api",

View file

@ -483,12 +483,9 @@ impl Service {
));
}
if !state_res::event_auth::auth_check(
&room_version,
&incoming_pdu,
None::<PduEvent>, // TODO: third party invite
|k, s| auth_events.get(&(k.to_string().into(), s.to_owned())),
)
if !state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
auth_events.get(&(k.to_string().into(), s.to_owned()))
})
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed"))?
{
return Err(Error::BadRequest(
@ -792,11 +789,8 @@ impl Service {
debug!("Starting auth check");
// 11. Check the auth of the event passes based on the state of the event
let check_result = state_res::event_auth::auth_check(
&room_version,
&incoming_pdu,
None::<PduEvent>, // TODO: third party invite
|k, s| {
let check_result =
state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
services()
.rooms
.short
@ -805,9 +799,8 @@ impl Service {
.flatten()
.and_then(|shortstatekey| state_at_incoming_event.get(&shortstatekey))
.and_then(|event_id| services().rooms.timeline.get_pdu(event_id).ok().flatten())
},
)
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?;
})
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?;
if !check_result {
return Err(Error::bad_database(
@ -825,12 +818,9 @@ impl Service {
&incoming_pdu.content,
)?;
let soft_fail = !state_res::event_auth::auth_check(
&room_version,
&incoming_pdu,
None::<PduEvent>,
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
)
let soft_fail = !state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
auth_events.get(&(k.clone(), s.to_owned()))
})
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?
|| incoming_pdu.kind == TimelineEventType::RoomRedaction
&& match room_version_id {

View file

@ -233,7 +233,6 @@ impl Service {
let authenticated = state_res::event_auth::auth_check(
&state_res::RoomVersion::new(&room_version_id).expect("room version is supported"),
&parsed_join_pdu,
None::<PduEvent>, // TODO: third party invite
|k, s| {
services()
.rooms

View file

@ -766,12 +766,9 @@ impl Service {
signatures: None,
};
let auth_check = state_res::auth_check(
&room_version,
&pdu,
None::<PduEvent>, // TODO: third_party_invite
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
)
let auth_check = state_res::auth_check(&room_version, &pdu, |k, s| {
auth_events.get(&(k.clone(), s.to_owned()))
})
.map_err(|e| {
error!("{:?}", e);
Error::bad_database("Auth check failed.")