Output Encoding
Also called Output Escaping.
Encoding data for its context so it renders as text, not code.
What it is
The practice of transforming data into a context-appropriate, inert representation when it is written into HTML, attributes, JavaScript, or URLs, so that any special characters are displayed as data rather than interpreted as markup or code.
Why it matters
Correct, context-aware output encoding is the primary defense against XSS, and reviewers verify it because validation alone cannot safely handle every place untrusted data is rendered.
In practice
Encoding a user's name so an embedded angle-bracket payload shows as text instead of running as script.
What to look for
- User data written into HTML, attributes, scripts or URLs.
- Templates with auto escaping turned off.
- The same encoding used in every context.
Common mistake
Using one encoding everywhere. HTML, attribute, JavaScript and URL contexts each need their own.
Practice it nearby
CyberKit has no tool for this term itself. These are the closest places to practice it.
- Email Header Analyzer
Walk the Received chain, and read the SPF, DKIM and DMARC verdicts.
- Phishing Case
A reported invoice email: pull the deciding values out of its raw headers, and say what they establish.
In the field
Well-known tools where this shows up on the job. They are listed to show the landscape, not as a recommendation.
-
Burp Suite Commercial
An intercepting proxy for testing web apps by hand and with its scanner.
-
ZAP Open source
An open source web app scanner and proxy, often run in CI pipelines.
-
Cloudflare WAF Commercial
Blocks common web attacks at the edge while the code gets fixed.
Read next
- Cross-Site Scripting: Injecting attacker script that runs in other users' browsers.
- Input Validation: Checking that incoming data matches expected type, format, and range.
- Content Security Policy: A header that restricts which sources a page may load and run.