Skip to content

Commit 9e59aa7

Browse files
security: add capability check to autocomplete ajax endpoint
1 parent c78981f commit 9e59aa7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/admin/class-autocomplete.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public function init(): void
1818
*/
1919
public function ajax(): void
2020
{
21+
if (! current_user_can('edit_box')) {
22+
wp_die('', '', [ 'response' => 403 ]);
23+
}
24+
2125
$q = ( isset($_GET['q']) ) ? sanitize_text_field($_GET['q']) : '';
2226
$type = ( isset($_GET['type']) && in_array($_GET['type'], [ 'page', 'post', 'category', 'post_type', 'post_tag' ], true) ) ? $_GET['type'] : 'post';
2327

0 commit comments

Comments
 (0)