强化经常误用身份验证的修复程序

vee*_*era 6 java fortify fortify-source

当我使用fortify进行扫描时,在以下代码中发现了诸如“经常被滥用:身份验证”之类的漏洞。为此,我们有任何解决方法可以避免此问题。我看过相关文章,但无法获得解决方案。使用ESAPI,我为主机名和ipadress提供了正则表达式,但它不起作用。 addr.getHostAddress() java.net.InetAddress.getByName(nameServiceHost); java.net.InetAddress.getLocalHost().getCanonicalHostName() localhost.getHostName()

请建议我解决此问题。

Bha*_*kar -1

您可以验证请求是否来自受信任的主机

String ip = request.getRemoteAddr(); 
InetAddress addr = InetAddress.getByName(ip); 
if (addr.getCanonicalHostName().endsWith("trustme.com")) { 
 trusted = true; 
} 
Run Code Online (Sandbox Code Playgroud)