How to fix Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) with error message?

后端 未结 5 1940
野趣味
野趣味 2020-12-10 19:29

We use web control adapter in our login page. Recently we run VeraCode on our web application. In following function, we got CWE80, Improper Neutralization of Script-Related

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 19:54

    You can also use Apache Commons Lang3 library StringEscapeUtils. It has various methods for encoding the strings. e.g. escapeXml(string), escapeHtml(string) etc.

    rev.ErrorMessage = StringEscapeUtils.escapeHtml(msg);
    

提交回复
热议问题