Security for Your Plugins
View Slide
I’m Brad Parbs.
Nathan, you should watchBand of Brothers.
Let’s talk about whatsucks in WordPress.
“20% of the 50 most popular WordPressplugins are vulnerable to common Webattacks. This amounts to nearly 8 milliondownloads of vulnerable plugins.”Checkmarx, an application security company
Things that happen whenyour stuff isn’t secure.
How do we make surethis doesn’t happen?
Always develop withdebugging ON
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', true ); define( 'SCRIPT_DEBUG', true ); define( 'WP_CACHE', false );
Sanitize all the things
intval(); absint();
wp_kses();
sanitize_title();
sanitize_email() sanitize_file_name() sanitize_html_class() sanitize_key() sanitize_meta() sanitize_mime_type() sanitize_option() sanitize_sql_orderby() sanitize_post_field() sanitize_text_field() sanitize_title() sanitize_title_for_query() sanitize_title_with_dashes() sanitize_user()
Escape all the things
esc_html();
esc_textarea();
esc_attr();
esc_url();
http://codex.wordpress.org/Data_Validation
Database Queries
$wpdb-‐>insert();
$wpdb-‐>update();
$wpdb-‐>prepare();
Nonces
wp_nonce_url();
wp_nonce_field();
wp_create_nonce();
check_admin_referer();
wp_verify_nonce();
Remote Data
CURL is bad.
For real, CURL is bad.
wp_remote_get();
wp_remote_post();
wp_remote_request();
Check capabilities &roles
current_user_can();
Use native functions
A story aboutTimThumb
Questions?