mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
REST API: Issue a _doing_it_wrong when registering a route without a permission callback.
The REST API treats routes without a permission_callback as public. Because this happens without any warning to the user, if the permission callback is unintentionally omitted or misspelled, the endpoint can end up being available to the public. Such a scenario has happened multiple times in the wild, and the results can be catostrophic when it occurs. For REST API routes that are intended to be public, it is recommended to set the permission callback to the `__return_true` built in function. Fixes #50075. Props rmccue, sorenbronsted, whyisjake, SergeyBiryukov, TimothyBlynJacobs. git-svn-id: https://develop.svn.wordpress.org/trunk@48526 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -36,9 +36,10 @@ final class WP_oEmbed_Controller {
|
||||
'/embed',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'args' => array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => '__return_true',
|
||||
'args' => array(
|
||||
'url' => array(
|
||||
'description' => __( 'The URL of the resource for which to fetch oEmbed data.' ),
|
||||
'required' => true,
|
||||
|
||||
Reference in New Issue
Block a user