Update proxy permissions URL to pass through backend #1985
Labels
Milestone
Comments
|
IB |
|
@aaemnnosttv I've updated the ACs and IB to reflect the updated names from #2094 which I accidentally opened as a duplicate. |
6 tasks
7 tasks
|
QA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Feature Description
In #1857, we changed the way the proxy setup URL works to be similar to the
connectanddisconnectURLs by using a WP "admin action" URL. This allows us to do additional permission and capability checks before sending the user to the proxy. It also exposes less sensitive information to the client than is necessary.Since the above issue is already very large, it makes sense to split out this portion to update the permissions URL to function in a similar way as this URL also contains some of the same information such as proxy credentials.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Authentication::get_proxy_permissions_url()which returns a URL similar toAuthentication::get_proxy_setup_url()but for a different actionGoogle_Proxy::ACTION_PERMISSIONS(and corresponding nonce).authenticate, whether the proxy is in use, and only then it should redirect to the real proxy permissions URL (OAuth_Client::get_proxy_permissions_url()).admin_action_googlesitekit_proxy_permissionsaction handler which when called, qualifies the current user before redirecting them to theOAuth_Client::get_proxy_permissions_urlproxyPermissionsURLprovided to the client should be in the form:{admin_url}?action=googlesitekit_proxy_permissions&nonce={nonce}Implementation Brief
Google_Proxy::ACTION_PERMISSIONSclass constant for thegooglesitekit_proxy_permissionsliteralAuthentication::get_proxy_permissions_urlmethod, essentially returning:proxyPermissionsURLinAuthentication::inline_js_base_datato use the newget_proxy_permissions_urlinstead so that the client always sends users through the WP backend to get there.Authentication::register, add a new action on'admin_action_' . Google_Proxy::ACTION_PERMISSIONSwhich calls a new private methodhandle_proxy_permissions:current_user_can( Permissions::AUTHENTICATE )wp_diewith insufficient permissions message (use the same as core)credentials->using_proxy()wp_diewith insufficient permissions message (use the same as core)$_GET['nonce']withGoogle_Proxy::ACTION_PERMISSIONSas the action orwp_die(use the same message as core for bad/expired nonce)OAuth_Client->get_proxy_permissions_url()Tests
PHPUnit
AuthenticationTestto include coverage for the added'admin_action_' . Google_Proxy::ACTION_PERMISSIONSactionQA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: