output encoding
Converting data into a safe form for the exact place it is written, such as HTML text or an attribute, so the browser shows it instead of running it.
In more detail
It is the escaping defence applied at the point of output, with rules that depend on whether the value lands in HTML text, an attribute, a URL or a script. Use the encoder that ships with your template engine or language, such as html.escape.
Examples
In the course html.escape turns the script tag into harmless text.'<p>' + escape(payload) + '</p>'Related terms
- escaping — Rewriting special characters in a value so an interpreter reads them as plain text, for example turning < into < in HTML.
- cross-site scripting — An attack in which someone gets their own script to run inside your page, where it can read data, act as the user or steal tokens.
Taught in
- Cross-Site Scripting — Application Security & Threat Modeling for Engineers
- Dynamic Scanning — Application Security & Threat Modeling for Engineers