use 403 for auth check fails everywhere else
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
1b41e35f1d
commit
6394b1812c
2 changed files with 6 additions and 6 deletions
|
@ -406,9 +406,9 @@ impl Service {
|
||||||
None::<PduEvent>, // TODO: third party invite
|
None::<PduEvent>, // TODO: third party invite
|
||||||
|k, s| auth_events.get(&(k.to_string().into(), s.to_owned())),
|
|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::forbidden(), "Auth check failed"))?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed"));
|
return Err(Error::BadRequest(ErrorKind::forbidden(), "Auth check failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
trace!("Validation successful.");
|
trace!("Validation successful.");
|
||||||
|
@ -491,11 +491,11 @@ impl Service {
|
||||||
.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::forbidden(), "Auth check failed."))?;
|
||||||
|
|
||||||
if !check_result {
|
if !check_result {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::InvalidParam,
|
ErrorKind::forbidden(),
|
||||||
"Event has failed auth check with state at the event.",
|
"Event has failed auth check with state at the event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ impl Service {
|
||||||
let soft_fail = !state_res::event_auth::auth_check(&room_version, &incoming_pdu, None::<PduEvent>, |k, s| {
|
let soft_fail = !state_res::event_auth::auth_check(&room_version, &incoming_pdu, None::<PduEvent>, |k, s| {
|
||||||
auth_events.get(&(k.clone(), s.to_owned()))
|
auth_events.get(&(k.clone(), s.to_owned()))
|
||||||
})
|
})
|
||||||
.map_err(|_e| Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed."))?;
|
.map_err(|_e| Error::BadRequest(ErrorKind::forbidden(), "Auth check failed."))?;
|
||||||
|
|
||||||
// 13. Use state resolution to find new room state
|
// 13. Use state resolution to find new room state
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ impl Service {
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("Auth check failed: {:?}", e);
|
error!("Auth check failed: {:?}", e);
|
||||||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.")
|
Error::BadRequest(ErrorKind::forbidden(), "Auth check failed.")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if !auth_check {
|
if !auth_check {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue