Skip to content

Conversation

@Aust1nYao
Copy link

提交说明:基于openrasp当前1.3.8版本,提交了支持中创InforSuiteAS服务器的代码,新增1个文件夹,1个txt文件,9个java文件,修改5个java文件。

测试结果:针对vulns测试用例,所有测试用例均已测试通过。测试环境:CentOS 7 / 1.8.0_322(64位) / InforSuite ASV10.0/Firefox,rasp以单机模式运行(管理平台未测试)。

遗留说明:RaspInstall.jar 尚不支持在InforSuiteAS上安装rasp,这块代码未进行改造。

public boolean handleServerInfo(ClassLoader classLoader, ProtectionDomain domain) {
String version = "";
try {
// if (classLoader == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释删除

logDetectError("handle inforsuite startup failed", t);
}
if (!isJboss(classLoader)) {
if(version != null){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个空格,e.g if (version

Object outputStream = Reflection.getField(output, "outputStream");
int flag = (Integer) Reflection.getField(outputStream, "state");
isClosed = flag == 1;
}else if("com/cvicse/inforsuite/grizzly/http/io/OutputBuffer".equals(InforSuiteHttpResponseHook.clazzName)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码格式改下,} else if

@@ -0,0 +1 @@
@中创中间件原创代码
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件请删除

for (ServerDetector detector : detectors) {
if (detector.isClassMatched(className) && detector.handleServer(className, classLoader, domain)) {
HookHandler.LOGGER.info("detect server class: " + className);
if(className.equals("com/cvicse/loong/enterprise/inforsuite/bootstrap/ASMain")){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码格式调整下,if (

if (detector.isClassMatched(className) && detector.handleServer(className, classLoader, domain)) {
HookHandler.LOGGER.info("detect server class: " + className);
if(className.equals("com/cvicse/loong/enterprise/inforsuite/bootstrap/ASMain")){
detectors.subList(0,13).clear();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里清理detectors的目的是?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detect server时,区分中创应用服务器和Tomcat。
具体原因是因为中创应用服务器加载类中存在和Tomcat相同的类,如果不清理,会误判为Tomcat。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么是 0, 13?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前detects列表中共14个服务器名称,0-13。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好,这个代码不能合入,你需要看看是否有其他方式能解决问题

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个代码我做了更新,动态获取。是否可行?

detectors.subList(0,13).clear();
HookHandler.LOGGER.info("detect server class: " + className);
break;
}else{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else {

HookHandler.doRealCheckWithoutRequest(CheckParameter.Type.POLICY_SERVER_BES, CheckParameter.EMPTY_MAP);
} else if ("TongWeb8".equals(serverName)) {
HookHandler.doRealCheckWithoutRequest(CheckParameter.Type.POLICY_SERVER_TONGWEB8, CheckParameter.EMPTY_MAP);
}else if ("inforsuite".equals(serverName)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else if

@CaledoniaProject
Copy link
Collaborator

关于detector能够清空的问题,我们评估下哈

@Aust1nYao
Copy link
Author

关于detector能够清空的问题,我们评估下哈

好的,我们技术刚刚提供了另一种解决办法,我也提交一下。这两种解决办法的根本目的在于区分中创和Tomcat的日志输出标识,对于openrasp功能没有影响。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants