Skip to content

Commit acd02a7

Browse files
authored
Merge pull request #472 from lostsnow/fix/xxe-check-reflect-exception-catch
fixes xxe check reflect exception catch
2 parents ff8d89b + cea3f31 commit acd02a7

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/vulscan/dynamic/xxe/XMLInputFactoryCheck.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ && getParentObjectHasSuffix(normalizeWrapper, ".DisallowDoctypeDeclInputFactoryW
2222
}
2323
return Support.ALLOWED;
2424
}
25-
Method isPropertySupportedMethod = ReflectUtils.getDeclaredMethodFromClass(cls, "isPropertySupported", new Class[]{String.class});
26-
Method getPropertyMethod = ReflectUtils.getDeclaredMethodFromClass(cls, "getProperty", new Class[]{String.class});
2725
try {
26+
Method isPropertySupportedMethod = ReflectUtils.getDeclaredMethodFromClass(cls, "isPropertySupported", new Class[]{String.class});
27+
Method getPropertyMethod = ReflectUtils.getDeclaredMethodFromClass(cls, "getProperty", new Class[]{String.class});
28+
2829
boolean supportDTD = invokeXMLInputFactoryMethod(isPropertySupportedMethod, getPropertyMethod, obj,
2930
" javax.xml.stream.supportDTD".substring(1));
3031
if (!supportDTD) {

dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/vulscan/dynamic/xxe/XMLStreamReaderCheck.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ public Support getSupport(Object obj) {
3232
return Support.DISALLOWED;
3333
}
3434
}
35-
Field fPropertyManagerField = ReflectUtils.getDeclaredFieldFromClassByName(obj.getClass(), "fPropertyManager");
36-
if (fPropertyManagerField == null) {
37-
return Support.ALLOWED;
38-
}
35+
3936
try {
37+
Field fPropertyManagerField = ReflectUtils.getDeclaredFieldFromClassByName(obj.getClass(), "fPropertyManager");
38+
if (fPropertyManagerField == null) {
39+
return Support.ALLOWED;
40+
}
41+
4042
return getPropertySupport(fPropertyManagerField.get(obj));
4143
} catch (IllegalAccessException e) {
4244
DongTaiLog.debug("Failed to access fPropertyManager {}", e);

0 commit comments

Comments
 (0)