reject device keys if they dont match user ID or device ID or are missing fields
Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
@@ -48,6 +48,19 @@ pub(crate) async fn upload_keys_route(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(device_keys) = &body.device_keys {
|
if let Some(device_keys) = &body.device_keys {
|
||||||
|
let deser_device_keys = device_keys.deserialize()?;
|
||||||
|
|
||||||
|
if deser_device_keys.user_id != sender_user {
|
||||||
|
return Err!(Request(Unknown(
|
||||||
|
"User ID in keys uploaded does not match your own user ID"
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
if deser_device_keys.device_id != sender_device {
|
||||||
|
return Err!(Request(Unknown(
|
||||||
|
"Device ID in keys uploaded does not match your own device ID"
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: merge this and the existing event?
|
// TODO: merge this and the existing event?
|
||||||
// This check is needed to assure that signatures are kept
|
// This check is needed to assure that signatures are kept
|
||||||
if services
|
if services
|
||||||
|
|||||||
Reference in New Issue
Block a user