Plugin

WordPress Plugin Security: Prevent Directory Listing

PHP based applications can have its structures exposed to the public. WordPress is also the same. This can have potential security risks if not taken care of properly. The agreed best practice is to configure the server, where the WordPress live, to prevent its directory structures. However, for average users, this might not be feasible.…

Read More »

WordPress Plugin Security: Preventing Direct Access

In plugin development, we will create PHP files which can be accessed and/or executed. These files need to be protected from unauthorized access. This is done by doing a check if the file is accessed directly. There are two approaches which we can implement. if ( ! defined(‘ABSPATH) ) exit; if ( ! defined(‘WPINC’) )…

Read More »

WordPress Plugin Security: Nonces

Data submission or request in WordPress can be a source of risk. We need to make sure that the data or request is submitted by the correct user with the necessary capabilities. Nonces are a generated number which only works once, this is used to verify the origin and intent for the requests done by the…

Read More »

WordPress Plugin Security: Sanitizing Output

Sanitizing output for plugin security is the process of stripping unwanted data which will be rendered to users. The unwanted data can be incorrect HTML or script tags. This process usually called escaping data. Escaping data can help in preventing Cross-Site Scripting. For the most common scenarios, these functions can be help securing WordPress: esc_html()…

Read More »

WordPress Plugin Security: Sanitazing Input

WordPress offer a variety of functions to sanitize input. Sanitizing is a process of formatting input into a standardized formats. This can help mitigate potentially unsafe data and convert them into safe ones. Functions which goes in sanitize_*() series can do many of sanitizing process. One example is the sanitize_email(). This functions will do validation on several things…

Read More »

WordPress Plugin Security: Data Validation

Data validation in WordPress plugin concern with the pattern of data processed by the plugin. Data with certain context should match the pattern generally acceptable. For example: Phone number only contain numerical content Postal code data contain valid postal code for designated country Required fields must be filled before processing The process of validation should…

Read More »

WordPress Plugin Security: User Capabilities

One aspect of plugin security which we need to take notice when developing WordPress plugin is the user roles and their capabilities. WordPress can have many user and they can have specific roles with different capabilities. The basic roles in WordPress area: Super Admin Administrator Editor Author Contributor Subscriber Each of this roles have different…

Read More »