c:out和esapi.encodeForHTML是多余的吗?

时间:2017-09-25 13:31:22

标签: jsp xss owasp

我知道JSTL标记会转义HTML,因此尖括号,撇号,&符号,双引号和特殊符号将替换为等效的命名字符实体。

但是,我被告知使用OWASP ESAPI库,使用类似:ESAPI.encoder().encodeForHTML( variable );的东西。我注意到一些代码提到here

<c:out value="<esapi:encodeForHTML>${variable}</esapi:encodeForHTML>"/>

我更愿意使用<c:out>${variable}</c:out>而非<% out.println(ESAPI.encoder().encodeForHTML( request.getParameter('paramName') ); %>或上述组合。是组合还原剂,即仅仅使用<c:out>...</c:cout>符号来预防XSS吗?

0 个答案:

没有答案