add legacy element hack for UIAA using invalid user field

see:
- e9302a9556
- https://github.com/element-hq/element-android/issues/8043
- https://github.com/element-hq/element-ios/issues/7405

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-06-06 03:43:21 -04:00
parent 3af153f5ae
commit 8428f43c78
4 changed files with 28 additions and 13 deletions

24
Cargo.lock generated
View file

@ -2721,7 +2721,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.10.1"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"assign",
"js_int",
@ -2741,7 +2741,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.10.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"js_int",
"ruma-common",
@ -2753,7 +2753,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.18.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"as_variant",
"assign",
@ -2776,7 +2776,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.13.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"as_variant",
"base64 0.22.1",
@ -2806,7 +2806,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.28.1"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"as_variant",
"indexmap 2.2.6",
@ -2828,7 +2828,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.9.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"js_int",
"ruma-common",
@ -2840,7 +2840,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.9.5"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"js_int",
"thiserror",
@ -2849,7 +2849,7 @@ dependencies = [
[[package]]
name = "ruma-identity-service-api"
version = "0.9.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"js_int",
"ruma-common",
@ -2859,7 +2859,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.13.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"once_cell",
"proc-macro-crate",
@ -2874,7 +2874,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.9.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"js_int",
"ruma-common",
@ -2886,7 +2886,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.15.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
@ -2902,7 +2902,7 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.11.0"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6"
source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15"
dependencies = [
"itertools 0.12.1",
"js_int",

View file

@ -67,6 +67,7 @@ dev_release_log_level = [
]
element_hacks = [
"conduit-api/element_hacks",
"conduit-service/element_hacks",
]
gzip_compression = [
"conduit-api/gzip_compression",

View file

@ -17,6 +17,7 @@ crate-type = [
]
[features]
element_hacks = []
dev_release_log_level = []
release_max_log_level = [
"tracing/max_level_trace",

View file

@ -58,9 +58,22 @@ impl Service {
AuthData::Password(Password {
identifier,
password,
#[cfg(feature = "element_hacks")]
user,
..
}) => {
let UserIdentifier::UserIdOrLocalpart(username) = identifier else {
#[cfg(feature = "element_hacks")]
let username = if let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier {
username
} else if let Some(username) = user {
username
} else {
return Err(Error::BadRequest(ErrorKind::Unrecognized, "Identifier type not recognized."));
};
#[cfg(not(feature = "element_hacks"))]
let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier
else {
return Err(Error::BadRequest(ErrorKind::Unrecognized, "Identifier type not recognized."));
};