How do I HTML Encode all the output in a web application?

前端 未结 11 1530
暖寄归人
暖寄归人 2020-12-10 17:20

I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every

11条回答
  •  孤街浪徒
    2020-12-10 17:42

    You don't want to encode all HTML, you only want to HTML-encode any user input that you're outputting.

    For PHP: htmlentities and htmlspecialchars

提交回复
热议问题