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]] [[package]]
name = "ruma" name = "ruma"
version = "0.10.1" 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 = [ dependencies = [
"assign", "assign",
"js_int", "js_int",
@ -2741,7 +2741,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-appservice-api" name = "ruma-appservice-api"
version = "0.10.0" 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 = [ dependencies = [
"js_int", "js_int",
"ruma-common", "ruma-common",
@ -2753,7 +2753,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-client-api" name = "ruma-client-api"
version = "0.18.0" 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 = [ dependencies = [
"as_variant", "as_variant",
"assign", "assign",
@ -2776,7 +2776,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-common" name = "ruma-common"
version = "0.13.0" 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 = [ dependencies = [
"as_variant", "as_variant",
"base64 0.22.1", "base64 0.22.1",
@ -2806,7 +2806,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-events" name = "ruma-events"
version = "0.28.1" 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 = [ dependencies = [
"as_variant", "as_variant",
"indexmap 2.2.6", "indexmap 2.2.6",
@ -2828,7 +2828,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-federation-api" name = "ruma-federation-api"
version = "0.9.0" 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 = [ dependencies = [
"js_int", "js_int",
"ruma-common", "ruma-common",
@ -2840,7 +2840,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-identifiers-validation" name = "ruma-identifiers-validation"
version = "0.9.5" 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 = [ dependencies = [
"js_int", "js_int",
"thiserror", "thiserror",
@ -2849,7 +2849,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-identity-service-api" name = "ruma-identity-service-api"
version = "0.9.0" 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 = [ dependencies = [
"js_int", "js_int",
"ruma-common", "ruma-common",
@ -2859,7 +2859,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-macros" name = "ruma-macros"
version = "0.13.0" 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 = [ dependencies = [
"once_cell", "once_cell",
"proc-macro-crate", "proc-macro-crate",
@ -2874,7 +2874,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-push-gateway-api" name = "ruma-push-gateway-api"
version = "0.9.0" 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 = [ dependencies = [
"js_int", "js_int",
"ruma-common", "ruma-common",
@ -2886,7 +2886,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-signatures" name = "ruma-signatures"
version = "0.15.0" 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 = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"ed25519-dalek", "ed25519-dalek",
@ -2902,7 +2902,7 @@ dependencies = [
[[package]] [[package]]
name = "ruma-state-res" name = "ruma-state-res"
version = "0.11.0" 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 = [ dependencies = [
"itertools 0.12.1", "itertools 0.12.1",
"js_int", "js_int",

View file

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

View file

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

View file

@ -58,9 +58,22 @@ impl Service {
AuthData::Password(Password { AuthData::Password(Password {
identifier, identifier,
password, 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.")); return Err(Error::BadRequest(ErrorKind::Unrecognized, "Identifier type not recognized."));
}; };