Content Security Policy — Preventing XSS Attacks Client-side

An extra measure to preventing Cross-Site Scripting has now become a standard ready to be implemented. It’s as easy as including a Content-Security-Policy header on your sites Content-Security-Policy: script-src ‘self’; img-src ‘none’ With the (example) policy above, external scripts and images won’t be loaded on your site. This new header however doesn’t mean you’re fully …

Logging client-side errors

function logError(details) { $.ajax({ type: ‘POST’, url: ‘http://mydomain.com/api/1/errors’, data: JSON.stringify({context: navigator.userAgent, details: details}), contentType: ‘application/json; charset=utf-8’ }); } window.onerror = function(message, file, line) { logError(file + ‘:’ + line + ‘\n\n’ + message); }; Let’s keep this short. Too few websites log JavaScript errors. Let’s build a simple system to track client-side errors. Makes clever …

PHP 5.5.0 alpha 1

PHP 5.5.0 alpha 1 was released a few days ago. New features include: support for Generators, a new password hashing API, support for finally in try/catch blocks, support for list() in foreach, constant array/string dereferencing, ext/intl improvement More info on these features can be read in Test Drive PHP 5.5: A Sneak Peek and What …

RE: Missing the bloody point

RE: Missing the bloody point Embrace the new tools that are coming. Don’t be afraid of the Big Bad Command Line™. Don’t become optimized for the fading past. Don’t get stuck. Okay, it’s scary. It literally is a black box (although Apple made it white). There’s no “undo” on the CLI. Things might break. And …