Skip to content

Commit

Permalink
More concrete details on output encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
wbamberg committed Dec 13, 2024
1 parent c3aa62f commit 4557801
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion files/en-us/web/security/attacks/xss/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,19 @@ This is the appropriate choice when you want to treat input as text, for example
<p>You searched for \{{ search_term }}.</p>
```

Most modern templating engines automatically perform output encoding. For example, if you pass `<img src=x onerror=alert('XSS!')>` into the Django template above, it will be rendered as text:
Most modern templating engines automatically perform output encoding. For example, Django's templating engine performs the following conversions:

- `<` is converted to `&lt;`

- `>` is converted to `&gt;`

- `'` is converted to `&#x27;`

- `"` is converted to `&quot;`

- `&` is converted to `&amp;`

This means that if you pass `<img src=x onerror=alert('XSS!')>` into the Django template above, it will be rendered as text:

> You searched for &lt;img src=x onerror=alert('XSS!')&gt;.
Expand Down

0 comments on commit 4557801

Please sign in to comment.