WordPress Plugin Security: Preventing SQL Injection

SQL Injection is code injection on SQL queries used in an application using SQL database. WordPress uses MySQL so it has risks getting an attack through SQL Injection. In OWASP (Open Web Application Security Project) Injection is listed as the top threat in web-based applications, SQL Injection is a part of it. We can prevent…

Read More »

Chrome DevTools: Empty Cache and Hard Reload

When I wrote plugins and themes I sometimes have a peculiarity when loading them in browsers. When I made changes in styles, the changes are not loaded even though I have saved them and there is no error. At first when I got this peculiarity I was frustrated searching for the errors in my codes.…

Read More »

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 »

WordPress Dev Environment: VSCode – Code Completion and Debugging

In the past, I have used various tools to edit codes, from full-featured IDE (Integrated Development Environment) to simple text editors. Around this past 5 months, I have been using Visual Studio Code (shorten to VSCode) for my programming and text editing. The applications suited my needs in working with a variety of programming languages and also…

Read More »