How to Sanitize User Input for XSS: Pros and Cons

XSS defenses go wrong when teams treat “sanitize user input” like a single magic step. It isn’t. Different kinds of input need different handling, and some of the most common advice online is flat-out incomplete. My opinion: if you only remember one thing, remember this — validate for business rules, encode for output, and sanitize only when you intentionally allow HTML. That distinction matters because “sanitizing input” can mean wildly different things: ...

June 20, 2026 · 7 min · headertest.com

How Browser Extensions Can Introduce XSS

Browser extensions are one of the weirdest XSS threat sources because the vulnerable code often isn’t yours. Your app can have solid output encoding, a decent CSP, and disciplined frontend code, then a user installs an extension that injects scripts, mutates the DOM, rewrites requests, or shoves untrusted HTML into your page. Suddenly your clean security model gets dragged into someone else’s mess. For developers, the hard part is that extension-driven XSS sits in an uncomfortable middle ground: ...

May 16, 2026 · 8 min · headertest.com