You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.2 KiB
26 lines
1.2 KiB
/*
|
|
* Copyright (c) 2023 - 2024. KeyWare.Co.Ltd All rights reserved.
|
|
* 项目名称:信息安全性设计准则检查插件
|
|
* 项目描述:用于检查源代码的安全性设计准则的Sonarqube插件
|
|
* 版权说明:本软件属北京关键科技股份有限公司所有,在未获得北京关键科技股份有限公司正式授权情况下,任何企业和个人,不能获取、阅读、安装、传播本软件涉及的任何受知识产权保护的内容。
|
|
*/
|
|
|
|
import java.net.*;
|
|
|
|
public class Example {
|
|
private boolean trusted;
|
|
|
|
public void getTrust(HttpServletRequest request) {// Noncompliant {{通过用户名口令、数据证书等其他手段对主机身份进行鉴别}}
|
|
String ip = request.getRemoteAddr();
|
|
InetAddress address = InetAddress.getByName(ip);
|
|
//攻击者可通过DNS欺骗绕过依赖域名的主机身份鉴别
|
|
if (address.getCanonicalHostName().endsWith("trustme.com")) {
|
|
trusted = true;
|
|
}
|
|
|
|
// String username = request.getParameter("username");
|
|
// String password = request.getParameter("password");
|
|
// if (username != null &.&.password != null){
|
|
// }
|
|
}
|
|
} |