修复打开直接问题是java

Fix open direct issue is java

我有以下代码,其中 veracode 安全扫描显示打开的重定向缺陷

response.sendRedirect(Targetlocation);

我试过了

if (!ESAPI.validator().isValidRedirectLocation("Redirect", tragetlocation, true)) {
                    System.out.println("Bad redirect location: ");
                } else {
response.sendRedirect(Targetlocation);

但还是不行。

此类缺陷还要求您提供 allow-list 您的应用程序认为“安全”重定向的内容。任何与该列表中的内容不匹配的内容都应被拒绝并记录。

但是,由于 Veracode 不会知道允许列表中的内容是否正确,您应该让安全工程师审查您更正的代码,并在 Veracode 门户中手动将其标记为已修复,因为Veracode 扫描器将无法决定什么是安全/不安全的,因此它不能真正自动化。