在Java中,在下面的行中:
TypedQuery<T> query=entityManger.createQuery(queryString, clazz);
List<T> result =query.getResultList();
据说,变量结果需要正确过滤或编码,否则可能会引发跨站点脚本攻击。
我已经使用了HtmlUtils.htmlEscape(queryString)
字符串对象。
如有任何帮助和建议,我们将不胜感激。感谢
Checkmarx最终将查看sink(输出(。然后,您必须在列表中的每个结果项中执行htmlEscape
List<T> newResult = new ArrayList<T>();
for (T temp : result) {
newResult.add(HtmlUtils.htmlEscape((String) temp));
}