|
16 | 16 | import java.lang.reflect.Modifier; |
17 | 17 | import java.util.ArrayList; |
18 | 18 | import java.util.Collection; |
19 | | -import java.util.Collections; |
20 | 19 | import java.util.Date; |
21 | 20 | import java.util.HashMap; |
22 | | -import java.util.HashSet; |
23 | 21 | import java.util.Iterator; |
24 | 22 | import java.util.List; |
25 | 23 | import java.util.Map; |
26 | | -import java.util.Set; |
27 | 24 | import org.slf4j.Logger; |
28 | 25 | import org.slf4j.LoggerFactory; |
29 | 26 |
|
30 | 27 | public final class ObjectIntrospection { |
31 | 28 |
|
32 | 29 | private static final Logger log = LoggerFactory.getLogger(ObjectIntrospection.class); |
33 | 30 |
|
34 | | - /** |
35 | | - * Field types excluded from object introspection. Covers Groovy meta-fields and logging framework |
36 | | - * loggers — both introduce deep, cyclic, or sensitive object graphs that are irrelevant for WAF |
37 | | - * inspection and can trigger false positives (e.g. crs-944-130). |
38 | | - */ |
39 | | - private static final Set<String> EXCLUDED_FIELD_TYPES; |
40 | | - |
41 | | - static { |
42 | | - final Set<String> types = new HashSet<>(); |
43 | | - types.add("groovy.lang.MetaClass"); |
44 | | - types.add("org.slf4j.Logger"); |
45 | | - types.add("org.apache.logging.log4j.Logger"); |
46 | | - types.add("org.apache.logging.log4j.core.Logger"); |
47 | | - types.add("java.util.logging.Logger"); |
48 | | - types.add("org.apache.commons.logging.Log"); |
49 | | - types.add("ch.qos.logback.classic.Logger"); |
50 | | - EXCLUDED_FIELD_TYPES = Collections.unmodifiableSet(types); |
51 | | - } |
52 | | - |
53 | 31 | private static final Method trySetAccessible; |
54 | 32 |
|
55 | 33 | static { |
@@ -309,7 +287,7 @@ private static Object doConversion(Object obj, int depth, State state) { |
309 | 287 | if (Modifier.isStatic(f.getModifiers())) { |
310 | 288 | continue; |
311 | 289 | } |
312 | | - if (EXCLUDED_FIELD_TYPES.contains(f.getType().getName())) { |
| 290 | + if (IntrospectionExcludedTypesTrie.apply(f.getType().getName()) >= 1) { |
313 | 291 | continue; |
314 | 292 | } |
315 | 293 | String name = f.getName(); |
|
0 commit comments