mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 08:41:24 +01:00
Bump ruma to e8b0876dda083433a7f9181d47d0aff5a5e05497 (auth check return type change)
This commit is contained in:
parent
644639ad10
commit
d8ec961589
5 changed files with 25 additions and 53 deletions
|
|
@ -1036,7 +1036,7 @@ async fn join_room_by_id_helper(
|
|||
}
|
||||
|
||||
info!("Running send_join auth check");
|
||||
let authenticated = state_res::event_auth::auth_check(
|
||||
state_res::event_auth::auth_check(
|
||||
&state_res::RoomVersion::new(&room_version_id).map_err(|_| {
|
||||
Error::UnsupportedRoomVersion(room_version_id.clone())
|
||||
})?,
|
||||
|
|
@ -1065,13 +1065,6 @@ async fn join_room_by_id_helper(
|
|||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed")
|
||||
})?;
|
||||
|
||||
if !authenticated {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
"Auth check failed",
|
||||
));
|
||||
}
|
||||
|
||||
info!("Saving state from send_join");
|
||||
let (statehash_before_join, new, removed) =
|
||||
services().rooms.state_compressor.save_state(
|
||||
|
|
|
|||
|
|
@ -501,19 +501,14 @@ impl Service {
|
|||
));
|
||||
}
|
||||
|
||||
if !state_res::event_auth::auth_check(
|
||||
state_res::event_auth::auth_check(
|
||||
&ruma_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(
|
||||
ErrorKind::InvalidParam,
|
||||
"Auth check failed",
|
||||
));
|
||||
}
|
||||
})?;
|
||||
|
||||
debug!("Validation successful");
|
||||
|
||||
|
|
@ -869,7 +864,7 @@ 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(
|
||||
state_res::event_auth::auth_check(
|
||||
&ruma_room_version,
|
||||
&incoming_pdu,
|
||||
|k, s| {
|
||||
|
|
@ -895,12 +890,6 @@ impl Service {
|
|||
.map_err(|_e| {
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.")
|
||||
})?;
|
||||
|
||||
if !check_result {
|
||||
return Err(Error::bad_database(
|
||||
"Event has failed auth check with state at the event.",
|
||||
));
|
||||
}
|
||||
debug!("Auth check succeeded");
|
||||
|
||||
// Soft fail check before doing state res
|
||||
|
|
@ -912,14 +901,12 @@ impl Service {
|
|||
&incoming_pdu.content,
|
||||
)?;
|
||||
|
||||
let auth_fail_against_current = !state_res::event_auth::auth_check(
|
||||
let auth_fail_against_current = state_res::event_auth::auth_check(
|
||||
&ruma_room_version,
|
||||
&incoming_pdu,
|
||||
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
|
||||
)
|
||||
.map_err(|_e| {
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.")
|
||||
})?;
|
||||
.is_err();
|
||||
|
||||
let cannot_redact = incoming_pdu.kind
|
||||
== TimelineEventType::RoomRedaction
|
||||
|
|
|
|||
|
|
@ -844,21 +844,13 @@ impl Service {
|
|||
signatures: None,
|
||||
};
|
||||
|
||||
let auth_check =
|
||||
state_res::auth_check(&ruma_room_version, &pdu, |k, s| {
|
||||
auth_events.get(&(k.clone(), s.to_owned()))
|
||||
})
|
||||
.map_err(|error| {
|
||||
error!(%error, "Auth check failed");
|
||||
Error::BadDatabase("Auth check failed.")
|
||||
})?;
|
||||
|
||||
if !auth_check {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"Event is not authorized.",
|
||||
));
|
||||
}
|
||||
state_res::auth_check(&ruma_room_version, &pdu, |k, s| {
|
||||
auth_events.get(&(k.clone(), s.to_owned()))
|
||||
})
|
||||
.map_err(|error| {
|
||||
error!(%error, "Auth check failed");
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.")
|
||||
})?;
|
||||
|
||||
// Hash and sign
|
||||
let mut pdu_json = utils::to_canonical_object(&pdu)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue