mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
Merge branch 'ruma-exhaustive-env-var' into 'next'
switch to env var for enabling ruma exhaustive types See merge request famedly/conduit!739
This commit is contained in:
commit
147161fda1
6 changed files with 26 additions and 41 deletions
|
@ -1,2 +1,2 @@
|
||||||
[build]
|
[env]
|
||||||
rustflags = ["--cfg=ruma_unstable_exhaustive_types"]
|
RUMA_UNSTABLE_EXHAUSTIVE_TYPES = "1"
|
||||||
|
|
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -2190,7 +2190,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
@ -2209,7 +2209,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2221,7 +2221,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.20.1"
|
version = "0.20.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"assign",
|
"assign",
|
||||||
|
@ -2244,7 +2244,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.15.1"
|
version = "0.15.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
@ -2275,7 +2275,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.30.1"
|
version = "0.30.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap 2.2.6",
|
"indexmap 2.2.6",
|
||||||
|
@ -2298,7 +2298,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"headers",
|
"headers",
|
||||||
|
@ -2320,7 +2320,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.11",
|
||||||
|
@ -2329,7 +2329,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.15.1"
|
version = "0.15.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
|
@ -2344,7 +2344,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2356,7 +2356,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.17.0"
|
version = "0.17.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
@ -2372,7 +2372,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#7c03b554c0d3e8b0a27fc0fadba36a4d636935d3"
|
source = "git+https://github.com/ruma/ruma.git#16185ab7fb1e054e8c37d8bf381d1e178dda0747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
|
|
@ -153,7 +153,6 @@ features = [
|
||||||
"compat-optional",
|
"compat-optional",
|
||||||
"compat-optional-txn-pdus",
|
"compat-optional-txn-pdus",
|
||||||
"compat-server-signing-key-version",
|
"compat-server-signing-key-version",
|
||||||
"compat-signature-id",
|
|
||||||
"compat-tag-info",
|
"compat-tag-info",
|
||||||
"compat-unset-avatar",
|
"compat-unset-avatar",
|
||||||
"federation-api",
|
"federation-api",
|
||||||
|
|
|
@ -483,12 +483,9 @@ impl Service {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if !state_res::event_auth::auth_check(
|
if !state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
|
||||||
&room_version,
|
auth_events.get(&(k.to_string().into(), s.to_owned()))
|
||||||
&incoming_pdu,
|
})
|
||||||
None::<PduEvent>, // TODO: third party invite
|
|
||||||
|k, s| auth_events.get(&(k.to_string().into(), s.to_owned())),
|
|
||||||
)
|
|
||||||
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed"))?
|
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed"))?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
@ -792,11 +789,8 @@ impl Service {
|
||||||
|
|
||||||
debug!("Starting auth check");
|
debug!("Starting auth check");
|
||||||
// 11. Check the auth of the event passes based on the state of the event
|
// 11. Check the auth of the event passes based on the state of the event
|
||||||
let check_result = state_res::event_auth::auth_check(
|
let check_result =
|
||||||
&room_version,
|
state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
|
||||||
&incoming_pdu,
|
|
||||||
None::<PduEvent>, // TODO: third party invite
|
|
||||||
|k, s| {
|
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.short
|
.short
|
||||||
|
@ -805,8 +799,7 @@ impl Service {
|
||||||
.flatten()
|
.flatten()
|
||||||
.and_then(|shortstatekey| state_at_incoming_event.get(&shortstatekey))
|
.and_then(|shortstatekey| state_at_incoming_event.get(&shortstatekey))
|
||||||
.and_then(|event_id| services().rooms.timeline.get_pdu(event_id).ok().flatten())
|
.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 {
|
if !check_result {
|
||||||
|
@ -825,12 +818,9 @@ impl Service {
|
||||||
&incoming_pdu.content,
|
&incoming_pdu.content,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let soft_fail = !state_res::event_auth::auth_check(
|
let soft_fail = !state_res::event_auth::auth_check(&room_version, &incoming_pdu, |k, s| {
|
||||||
&room_version,
|
auth_events.get(&(k.clone(), s.to_owned()))
|
||||||
&incoming_pdu,
|
})
|
||||||
None::<PduEvent>,
|
|
||||||
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
|
|
||||||
)
|
|
||||||
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?
|
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?
|
||||||
|| incoming_pdu.kind == TimelineEventType::RoomRedaction
|
|| incoming_pdu.kind == TimelineEventType::RoomRedaction
|
||||||
&& match room_version_id {
|
&& match room_version_id {
|
||||||
|
|
|
@ -233,7 +233,6 @@ impl Service {
|
||||||
let authenticated = state_res::event_auth::auth_check(
|
let authenticated = state_res::event_auth::auth_check(
|
||||||
&state_res::RoomVersion::new(&room_version_id).expect("room version is supported"),
|
&state_res::RoomVersion::new(&room_version_id).expect("room version is supported"),
|
||||||
&parsed_join_pdu,
|
&parsed_join_pdu,
|
||||||
None::<PduEvent>, // TODO: third party invite
|
|
||||||
|k, s| {
|
|k, s| {
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
|
|
|
@ -766,12 +766,9 @@ impl Service {
|
||||||
signatures: None,
|
signatures: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let auth_check = state_res::auth_check(
|
let auth_check = state_res::auth_check(&room_version, &pdu, |k, s| {
|
||||||
&room_version,
|
auth_events.get(&(k.clone(), s.to_owned()))
|
||||||
&pdu,
|
})
|
||||||
None::<PduEvent>, // TODO: third_party_invite
|
|
||||||
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
|
|
||||||
)
|
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("{:?}", e);
|
error!("{:?}", e);
|
||||||
Error::bad_database("Auth check failed.")
|
Error::bad_database("Auth check failed.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue