Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kharissulistiyo/7c969a3d91d0cf7edf1fafd5b592676a to your computer and use it in GitHub Desktop.
Save kharissulistiyo/7c969a3d91d0cf7edf1fafd5b592676a to your computer and use it in GitHub Desktop.
Patch code sample: Sensitive Data Exposure vulnerability
<?php
register_rest_route($this->namespace . '/v1', '/newsletter', array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array($this, 'get_subscribers_callback'),
'args' => array(
'group_id' => array(
'required' => false,
)
),
'permission_callback' => array($this, 'getSubscribersPermission')
)
));
* Check user permission
*
* @param $request
*
* @return bool
*/
public function getSubscribersPermission($request) {
return current_user_can('wpsms_subscribers');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment