cloudflare / Cloudflare-WordPress

A Cloudflare plugin for WordPress
https://www.cloudflare.com/wordpress/
BSD 3-Clause "New" or "Revised" License
215 stars 84 forks source link

Prevent usage of `cloudflare_proxy` action on /admin-ajax endpoint for non-Administrator users #529

Closed aseure closed 9 months ago

aseure commented 9 months ago

🔖 Summary

The implementation of this plugin is hidden behind a is_admin() WordPress function. However, as stated in the documentation:

Does not check if the user is an administrator; use current_user_can() for checking roles and capabilities.

This commit is about ensuring that the cloudflare_proxy action on the /admin-ajax endpoint is correctly limited to Administrator users only before making any call via the Proxy to Cloudflare.

✅ Testing plan

Update the mocked tests which were rightfully failing due to non-Administrator calls.