SiteShadow
Back to vulnerability library

SCP02 Output Encoding

What this means

SiteShadow flagged output being rendered without context-appropriate encoding/escaping. This often becomes cross-site scripting (XSS) or content injection when untrusted data is placed into HTML, attributes, URLs, or JavaScript contexts.

Why it matters

Missing output encoding leads to XSS and injection in rendered views.

Safer examples

1) Prefer safe text APIs in the DOM

el.textContent = userInput; // safe
// el.innerHTML = userInput; // risky

2) Avoid "raw HTML" escape hatches in templates

Most frameworks escape by default—don't disable it unless you fully control the content.

3) Sanitize only when you must render user HTML

import DOMPurify from "dompurify";

el.innerHTML = DOMPurify.sanitize(userHtml);

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage