XSS Injection Contexts Playground

One notice in 5 places (HTML text, attribute, href, script string, style): each place with the escaper picked for it, checked on the built output. An…

Why it matters

XSS is the most commonly met OWASP Top 10 issue, and most bugs are born from assuming there is "one escape function" safe everywhere. But escapeHtml for text is no substitute for scheme checking in an href or escapeJs in a script string. Knowing the output context means knowing why frameworks auto-escape per context, and why raw data in an href/<script>/<style> stays dangerous even when "already escaped".

The key idea

There is no single escape function; escaping must match the output context

Common mistakes

Try it in this playground