December 2015
Intermediate to advanced
232 pages
5h 8m
English
There’s a reason why XSS vulnerabilities are so common in the wild: they’re difficult to get rid of. Sanitizing sounds simple in principle, but escaping and disallowing characters can get complicated quickly. Let’s look at various rules from the OWASP XSS Prevention Cheat Sheet,[68] which you should keep in mind when building your site.
But first, a small test: in the following code example there’s an HTML document—actually, an Embedded JavaScript[69] (EJS) template. Do you know where you could in theory put unsafe content and where you should never put unsafe content?
| | <!DOCTYPE html> |
| | <html> |
| | <head lang="en"> |
| | <meta charset="UTF-8"> |
| | <title>My XSS</title> |
| | <!--<%- 1 %>--> ... |
Read now
Unlock full access