@@ -131,7 +131,7 @@ public static boolean isAllowTaintType(Class<?> objType) {
131131 }
132132
133133 public static boolean isAllowTaintType (Object obj ) {
134- if (obj == null ) {
134+ if (obj == null || obj instanceof Enumeration ) {
135135 return false ;
136136 }
137137 return isAllowTaintType (obj .getClass ());
@@ -146,10 +146,10 @@ public static void trackObject(MethodEvent event, PolicyNode policyNode, Object
146146 long identityHash = 0 ;
147147 boolean isSourceNode = policyNode instanceof SourceNode ;
148148 if (isSourceNode ) {
149- if (obj instanceof String ){
149+ if (obj instanceof String ) {
150150 identityHash = System .identityHashCode (obj );
151- hash = toStringHash (obj .hashCode (),identityHash );
152- }else {
151+ hash = toStringHash (obj .hashCode (), identityHash );
152+ } else {
153153 hash = System .identityHashCode (obj );
154154 identityHash = hash ;
155155 }
@@ -195,7 +195,7 @@ public static void trackObject(MethodEvent event, PolicyNode policyNode, Object
195195 EngineManager .TAINT_HASH_CODES .add (hash );
196196 event .addTargetHash (hash );
197197 EngineManager .TAINT_RANGES_POOL .add (hash , tr );
198- TaintPoolUtils .customModel (isMicroservice ,obj ,cls ,event ,policyNode ,depth );
198+ TaintPoolUtils .customModel (isMicroservice , obj , cls , event , policyNode , depth );
199199 } else {
200200 hash = getStringHash (obj );
201201 if (EngineManager .TAINT_HASH_CODES .contains (hash )) {
@@ -205,12 +205,12 @@ public static void trackObject(MethodEvent event, PolicyNode policyNode, Object
205205 }
206206 }
207207
208- private static void customModel (Boolean isMicroservice , Object obj , Class <?> cls , MethodEvent event ,PolicyNode policyNode ,int depth ) {
208+ private static void customModel (Boolean isMicroservice , Object obj , Class <?> cls , MethodEvent event , PolicyNode policyNode , int depth ) {
209209 if (isMicroservice && !(obj instanceof String ) && !PropertyUtils .isDisabledCustomModel ()) {
210210 try {
211211 Field [] declaredFields = ReflectUtils .getDeclaredFieldsSecurity (cls );
212212 for (Field field : declaredFields ) {
213- if (!Modifier .isStatic (field .getModifiers ())) {
213+ if (!Modifier .isStatic (field .getModifiers ()) && ! field . isSynthetic () && ! field . isEnumConstant () ) {
214214 trackObject (event , policyNode , field .get (obj ), depth + 1 , isMicroservice );
215215 }
216216 }
@@ -264,15 +264,15 @@ private static void trackOptional(MethodEvent event, PolicyNode policyNode, Obje
264264 }
265265 }
266266
267- public static Long toStringHash (long objectHashCode ,long identityHashCode ) {
267+ public static Long toStringHash (long objectHashCode , long identityHashCode ) {
268268 return (objectHashCode << 32 ) | (identityHashCode & 0xFFFFFFFFL );
269269 }
270270
271271 public static Long getStringHash (Object obj ) {
272272 long hash ;
273- if (obj instanceof String ){
274- hash = TaintPoolUtils .toStringHash (obj .hashCode (),System .identityHashCode (obj ));
275- }else {
273+ if (obj instanceof String ) {
274+ hash = TaintPoolUtils .toStringHash (obj .hashCode (), System .identityHashCode (obj ));
275+ } else {
276276 hash = System .identityHashCode (obj );
277277 }
278278 return hash ;
0 commit comments