Skip to content

Commit

Permalink
feat: 新增卸载时将QLExpressCheck和FastjsonCheck置空
Browse files Browse the repository at this point in the history
  • Loading branch information
UzJu committed Oct 25, 2023
1 parent df5314d commit 1fd237b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion dongtai-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,3 @@
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import io.dongtai.iast.common.state.AgentState;
import io.dongtai.iast.common.state.State;
import io.dongtai.iast.core.handler.hookpoint.models.policy.PolicyManager;
import io.dongtai.iast.core.handler.hookpoint.vulscan.dynamic.FastjsonCheck;
import io.dongtai.iast.core.handler.hookpoint.vulscan.dynamic.QLExpressCheck;
import io.dongtai.iast.core.init.IEngine;
import io.dongtai.iast.core.init.impl.ConfigEngine;
import io.dongtai.iast.core.init.impl.TransformEngine;
Expand Down Expand Up @@ -92,6 +94,10 @@ public static void stop() {
public static void destroy(String mode, String propertiesFilePath, Instrumentation inst) {
try {
DongTaiLog.info("Uninstall engine");
// 卸载对FastJson和QLExpress的调用
FastjsonCheck.clearJsonClassLoader();
FastjsonCheck.clearParseConfigClassLoader();
QLExpressCheck.clearQLClassLoader();
AgentEngine agentEngine = AgentEngine.getInstance();
assert agentEngine != null;
agentEngine.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,12 @@ public static void setJsonClassLoader(ClassLoader jsonClassLoader) {
public static void setParseConfigClassLoader(ClassLoader parseConfigClassLoader) {
PARSE_CONFIG_CLASS_LOADER = parseConfigClassLoader;
}

public static void clearJsonClassLoader(){
JSON_CLASS_LOADER = null;
}

public static void clearParseConfigClassLoader(){
PARSE_CONFIG_CLASS_LOADER = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ public boolean isSafe(MethodEvent event, SinkNode sinkNode){
public static void setQLClassLoader(ClassLoader qlClassLoader) {
QL_CLASS_LOADER = qlClassLoader;
}

public static void clearQLClassLoader(){
QL_CLASS_LOADER = null;
}
}

0 comments on commit 1fd237b

Please sign in to comment.