fail early and always return $response as fallback

This commit is contained in:
Matthias Pfefferle 2023-05-09 11:57:43 +02:00
parent c42edfce68
commit 96953dfc7e

View file

@ -80,7 +80,10 @@ class Server {
*/
public static function authorize_activitypub_requests( $response, $handler, $request ) {
$route = $request->get_route();
if ( str_starts_with( $route, '/activitypub' ) ) {
if ( ! str_starts_with( $route, '/activitypub' ) ) {
return $response;
}
if ( 'POST' === $request->get_method() ) {
$verified_request = Signature::verify_http_signature( $request );
if ( \is_wp_error( $verified_request ) ) {
@ -98,6 +101,7 @@ class Server {
}
}
}
}
return $response;
}
}