Standalone XSS (cross site scripting) utility
- Rick Strafy
- Nette Blogger | 81
You can use stand-alone latte for html text, that's the simplest option, since latte is context-aware and escaping is little more complicated, because it escapes text differently depending where it is (html attributes, javascript, inside tags). If you only want to escape xss inside html tags, you can use native php function htmlspecialchars($str)
Last edited by Rick Strafy (2022-09-29 17:45)
- Marek Bartoš
- Nette Blogger | 1261
Escaping should be always done on output, not on input, because it is
context-specific.
I guess you could dig deeper into Latte and use only its escaping functions,
but I would ask why don't just use the whole Latte.
Some basic input sanitization is done by RequestFactory in nette/http