Skip to content

Commit

Permalink
Debug Helper: restrict REST API access to site admins. (#36999)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve authored Apr 22, 2024
1 parent 20a2ce1 commit fa1eb0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

REST API: restrict access to authenticated site admins
4 changes: 3 additions & 1 deletion projects/plugins/debug-helper/modules/class-cookie-state.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function register_endpoints() {
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'save' ),
'permission_callback' => '__return_true',
'permission_callback' => function () {
return current_user_can( 'manage_options' );
},
'args' => array(
'key' => array(
'description' => 'The state key.',
Expand Down
4 changes: 3 additions & 1 deletion projects/plugins/debug-helper/modules/class-mocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function register_endpoints() {
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'run' ),
'permission_callback' => '__return_true',
'permission_callback' => function () {
return current_user_can( 'manage_options' );
},
)
);
}
Expand Down

0 comments on commit fa1eb0d

Please sign in to comment.