A web application is susceptible to cross-site scripting.
Which two methods allow this issue to be mitigated? (Choose two.)
Correct Answer: B,E
To mitigate this attack, the easiest way is to escape any user input, both when receiving it from the user and when sending data to other users. For example, replacing the < character with < or < for the web content would disable all HTML tags. In Python, this can be done with the standard html.escape() and html.unescape() functions. Sometimes some HTML tags are acceptable, so escaping them all is not an option. In this case, sanitization is a suitable solution.
Sanitization processes untrusted user input and runs it through the filter, which allows valid content but strips anything that is not permitted. For example, it may allow <A>, <IMG>, <B> HTML tags but strip any other tags.