HTML security

Why filtering HTML in the browser is not enough

Because the server does not know whether a request came from your editor. Anyone who can save content can also send arbitrary HTML with their own HTTP client, a modified form or another endpoint – and then the JavaScript filter never runs at all. Cleaning in the browser improves convenience and c…

HTML security

How to secure HTML from a WYSIWYG editor in PHP

You secure HTML from a WYSIWYG editor on the server: before every save, you pass it through a sanitizer built on a parser and an allowlist of tags, attributes, classes and URLs. On top of that come supporting layers – displaying content in the right context, a Content Security Policy header, safe…

RSS feed