WordCamp Seattle

I’m here at WordCamp Seattle, and wanted to post my slides and a few other notes. I’m giving two talks today, one in the development track on best practices for plugin development (“Y U NO CODE WELL”), and an Ignite talk on contributing to the WordPress community.

First, during my development talk, I was asked for five tips on writing secure code. In return, I pulled up a recent email I wrote where I provided 10 tips:

Never trust the user. You need to assume that all user input is insecure, and that all output is unescaped. The primary points are:

  1. Always escape attributes, URLs, and text on output.
  2. Always sanitize, scrub and validate input.
  3. Always prepare database queries.
  4. Never trust the user.
  5. Never output anything that is unsanitized or unescaped.
  6. Never store anything that is unsanitized.
  7. Know the difference between authority and intention.
  8. Never trust the user.
  9. Always use the many helper functions — we make it easy to write secure code.
  10. Never trust the user.

Best Practices for Plugin Development

Ignite Talk: Ask Not What WordPress Can Do For You

13 thoughts on “WordCamp Seattle

  1. Wish I could have made this camp, really like the slide, will have to watch the video on WordPress TV.

    I’ve already picked up a few new tricks. Thanks buddy.

  2. Hi Nacin,

    Actually I’ve just written a post (How To Set Up Site Speed For Google Analytics In WordPress) where I’ve argued that in some cases you have to trust the user:

    Joost de Valk’s Google Analytics for WordPress plugin allows the user to enter JavaScript code that’s added to the Google Analytics code. However, it doesn’t stripslashes when adding it to the page. As a result the custom code doesn’t work, at least in some cases, because the slashes change the meaning of the JavaScript code, ie:

    _gaq.push([\'_trackPageLoadTime\']);

    So, my reasoning is that if the user is entering information that’s going to be displayed in the code, don’t trust them. But if the user is entering code that’s going to be run, as in the case above, well you have to trust them. If you really don’t trust them, then you don’t give them the ability to add code.

    Another eg is the plugin / theme editors in WordPress. You have to trust the user’s input, or you have to remove the editors!

    So maybe I’m just stating the obvious, but I guess what I’m really saying is that it’s not as simple as “never trust the user”. It depends on the purpose of the user input. I’d love to hear your perspective on this.

  3. @Stephen Cronin so true! There are times users must realize that their input code will be inserted in their own site lol

  4. Pingback: Plugin Review: List category posts | Sterling Hamilton

  5. Pingback: Plugin Review: WP SnapEngage | Sterling Hamilton

  6. Pingback: Plugin Review: WP Issuu | Sterling Hamilton

  7. Pingback: Plugin Review: Google Analytics for WordPress by Yoast | Sterling Hamilton

  8. Pingback: Plugin Review: MapPress Easy Google Maps | Sterling Hamilton

  9. Pingback: Plugin Review: Iframe Embedder | Sterling Hamilton

  10. Pingback: How To Add Site Speed For Google Analytics In WordPress

Comments are closed.