-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Please add a nonce check to your input calls ($_POST, $_GET, $REQUEST) to prevent unauthorized access.
If you use wp_ajax_ to trigger submission checks, remember they also need a nonce check.
👮 Checking permissions: Keep in mind, a nonce check alone is not bulletproof security. Do not rely on nonces for authorization purposes. When needed, use it together with current_user_can() in order to prevent users without the right permissions from accessing things they shouldn't.
Also make sure that the nonce logic is correct by making sure it cannot be bypassed. Checking the nonce with current_user_can() is great, but mixing it with other checks can make the condition more complex and, without realising it, bypassable, remember that anything can be sent through an input, don't trust any input.
Keep performance in mind. Don't check for post submission outside of functions. Doing so means that the check will run on every single load of the plugin, which means that every single person who views any page on a site using your plugin will be checking for a submission. This will make your code slow and unwieldy for users on any high traffic site, leading to instability and eventually crashes.
The following links may assist you in development:
https://developer.wordpress.org/plugins/security/nonces/
https://developer.wordpress.org/plugins/javascript/ajax/#nonce
https://developer.wordpress.org/plugins/settings/settings-api/
Please, make sure that the nonce logic is correct.
includes/class-paybutton-admin.php:304 if ( isset( $_GET['paybutton_customers_nonce'] ) &&
includes/class-paybutton-admin.php:392 if ( isset( $_GET['paybutton_content_nonce'] ) &&