Skip to content

Commit 852c41f

Browse files
authored
Fix Undefined array key "keyId" error (#1936)
1 parent f7b7c87 commit 852c41f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

includes/signature/class-http-signature-draft.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ public function verify( array $headers, $body = null ) {
8585
return new \WP_Error( 'missing_signature', 'No Signature or Authorization header present.' );
8686
}
8787

88-
$header = $headers['signature'] ?? $headers['authorization'];
89-
$parsed = $this->parse_signature_header( $header[0] );
88+
$header = $headers['signature'] ?? $headers['authorization'];
89+
$parsed = $this->parse_signature_header( $header[0] );
90+
91+
if ( empty( $parsed['keyId'] ) ) {
92+
return new \WP_Error( 'activitypub_signature', 'No Key ID present.' );
93+
}
94+
9095
$public_key = Actors::get_remote_key( $parsed['keyId'] );
9196
if ( \is_wp_error( $public_key ) ) {
9297
return $public_key;

0 commit comments

Comments
 (0)