Skip to content

Commit 6810884

Browse files
authored
have a filter to defer signature verification (#435)
1 parent 24d12de commit 6810884

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

includes/rest/class-server.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,23 @@ public static function authorize_activitypub_requests( $response, $handler, $req
8989
return $response;
9090
}
9191

92+
/**
93+
* Filter to defer signature verification
94+
*
95+
* Skip signature verification for debugging purposes or to reduce load for
96+
* certain Activity-Types, like "Delete".
97+
*
98+
* @param bool $defer Whether to defer signature verification.
99+
* @param WP_REST_Request $request The request used to generate the response.
100+
*
101+
* @return bool Whether to defer signature verification.
102+
*/
103+
$defer = \apply_filters( 'activitypub_defer_signature_verification', false, $request );
104+
105+
if ( $defer ) {
106+
return $response;
107+
}
108+
92109
// POST-Requets are always signed
93110
if ( 'GET' !== $request->get_method() ) {
94111
$verified_request = Signature::verify_http_signature( $request );

0 commit comments

Comments
 (0)