Skip to content

Commit

Permalink
WordCamp Coming Soon Page: Add wccs_safelisted_namespaces.
Browse files Browse the repository at this point in the history
74765c1 changed the hook used to disable REST API endpoints, which unknowingly unhooked `WordPressdotorg\GDPR\disable_limited_access_plugin_for_routes()`. Adding a filter here restores that function's ability to do what it needs, but in a more reliable way.
  • Loading branch information
iandunn committed Aug 9, 2019
1 parent b58e7e1 commit cb785aa
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ public function disable_rest_endpoints( $response, $handler, $request ) {
* Jetpack endpoints are whitelisted because some of them are needed to connect sites to WordPress.com
* while Coming Soon is still enabled.
*
* Safelist entries generally _should not_ include a version number, to insure forward-compatibly. They
* _should_ include the directory markers and `v` prefix, though, to avoid false-positive matches.
*
* @todo This works, but there are some additional, unknown steps needed to allow connecting to WPCOM
* via the REST API. This is being left here because it will be needed when/if Jetpack removes XMLRPC
* support and uses the REST API exclusively for registration. If that happens, we'll need to figure
* out what extra steps are needed.
*/
$safelisted_namespaces = array( '/jetpack/v' );
$safelisted_namespaces = apply_filters( 'wccs_safelisted_namespaces', array( '/jetpack/v' ) );

$safelisted = array_filter( $safelisted_namespaces, function( $namespace ) use ( $request ) {
return false !== strpos( $request->get_route(), $namespace );
Expand Down

0 comments on commit cb785aa

Please sign in to comment.