mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-30 20:37:36 +00:00
fix: SEC29
Reviewed-By: Jacob Taylor <jacob@explodie.org> Reviewed-By: Jade Ellis <jade@ellis.link>
This commit is contained in:
2 files changed
+25
-5
No files matched your search
@@ -0,0 +1 @@
|
||||
SEC29 fix. See <https://forgejo.ellis.link/continuwuation/advisories> at a later date for more info. Contributed by @nex.
|
||||
@@ -18,7 +18,7 @@ use ruma::{
|
||||
EndpointError, IncomingResponseExt, OutgoingRequest, OutgoingRequestExt,
|
||||
SupportedVersions,
|
||||
auth_scheme::{AuthScheme, NoAuthentication},
|
||||
error::Error as RumaError,
|
||||
error::{Error as RumaError, ErrorKind},
|
||||
federation::authentication::{ServerSignatures, XMatrixSigningInput},
|
||||
path_builder::PathBuilder,
|
||||
},
|
||||
@@ -351,10 +351,29 @@ async fn into_http_response(
|
||||
debug!("Got {status:?} for {method} {url}");
|
||||
if !status.is_success() {
|
||||
let (parts, body) = http_response.into_parts();
|
||||
return Err(Error::Federation(
|
||||
dest.to_owned(),
|
||||
RumaError::from_http_response(http::Response::from_parts(parts, body.as_ref())),
|
||||
));
|
||||
let parsed_err =
|
||||
RumaError::from_http_response(http::Response::from_parts(parts, body.as_ref()));
|
||||
// Refuse to serve any error codes that shouldn't appear over
|
||||
// federation.
|
||||
match parsed_err.error_kind().unwrap_or(&ErrorKind::Unknown) {
|
||||
| ErrorKind::UnknownToken(_)
|
||||
| ErrorKind::MissingToken
|
||||
| ErrorKind::UnknownDevice
|
||||
| ErrorKind::UnknownPos
|
||||
| ErrorKind::UserSuspended
|
||||
| ErrorKind::UserLocked
|
||||
| ErrorKind::ResourceLimitExceeded(_)
|
||||
| ErrorKind::UserLimitExceeded(_)
|
||||
| ErrorKind::UserDeactivated => {
|
||||
return Err!(Request(Unknown(warn!(
|
||||
%dest,
|
||||
?parsed_err,
|
||||
"Remote server {dest} returned an unexpected error: {parsed_err}"
|
||||
))));
|
||||
},
|
||||
| _ => {},
|
||||
}
|
||||
return Err(Error::Federation(dest.to_owned(), parsed_err));
|
||||
}
|
||||
|
||||
Ok(http_response)
|
||||
|
||||
Reference in new issue
Block a user