@@ -160,51 +160,57 @@ public static void handlerCustomModel(MethodEvent event) {
160160 * @return Set<Object>
161161 */
162162 public static Set <Object > parseCustomModel (Object model ) {
163- Set <Object > modelValues = new HashSet <Object >();
164- if (!TaintPoolUtils .isNotEmpty (model )) {
165- return modelValues ;
166- }
167- Class <?> sourceClass = model .getClass ();
168- if (sourceClass .getClassLoader () == null ) {
169- return modelValues ;
170- }
171- String className = sourceClass .getName ();
172- if (className .startsWith ("cn.huoxian.iast.api." ) ||
173- className .startsWith ("io.dongtai.api." ) ||
174- className .startsWith (" org.apache.shiro.web.servlet" .substring (1 )) ||
175- VALUES_ENUMERATOR .equals (className ) ||
176- className .startsWith (SPRING_OBJECT ) ||
177- className .endsWith ("RequestWrapper" ) ||
178- className .endsWith ("ResponseWrapper" )
179-
180- ) {
181- return modelValues ;
182- }
183- // getter methods
184- Method [] methods = sourceClass .getMethods ();
185- Object itemValue = null ;
186- for (Method method : methods ) {
187- if (!TaintPoolUtils .isAllowTaintGetterMethod (method )) {
188- continue ;
163+ try {
164+ Set <Object > modelValues = new HashSet <Object >();
165+ if (!TaintPoolUtils .isNotEmpty (model )) {
166+ return modelValues ;
189167 }
190-
191- try {
192- itemValue = method .invoke (model );
193- if (!TaintPoolUtils .isNotEmpty (itemValue )) {
168+ Class <?> sourceClass = model .getClass ();
169+ if (sourceClass .getClassLoader () == null ) {
170+ return modelValues ;
171+ }
172+ String className = sourceClass .getName ();
173+ if (className .startsWith ("cn.huoxian.iast.api." ) ||
174+ className .startsWith ("io.dongtai.api." ) ||
175+ className .startsWith (" org.apache.tomcat" .substring (1 )) ||
176+ className .startsWith (" org.apache.catalina" .substring (1 )) ||
177+ className .startsWith (" org.apache.shiro.web.servlet" .substring (1 )) ||
178+ VALUES_ENUMERATOR .equals (className ) ||
179+ className .startsWith (SPRING_OBJECT ) ||
180+ className .contains ("RequestWrapper" ) ||
181+ className .contains ("ResponseWrapper" )
182+
183+ ) {
184+ return modelValues ;
185+ }
186+ // getter methods
187+ Method [] methods = sourceClass .getMethods ();
188+ Object itemValue = null ;
189+ for (Method method : methods ) {
190+ if (!TaintPoolUtils .isAllowTaintGetterMethod (method )) {
194191 continue ;
195192 }
196- modelValues .add (itemValue );
197- if (itemValue instanceof List ) {
198- List <?> itemValueList = (List <?>) itemValue ;
199- for (Object listValue : itemValueList ) {
200- modelValues .addAll (parseCustomModel (listValue ));
193+
194+ try {
195+ itemValue = method .invoke (model );
196+ if (!TaintPoolUtils .isNotEmpty (itemValue )) {
197+ continue ;
198+ }
199+ modelValues .add (itemValue );
200+ if (itemValue instanceof List ) {
201+ List <?> itemValueList = (List <?>) itemValue ;
202+ for (Object listValue : itemValueList ) {
203+ modelValues .addAll (parseCustomModel (listValue ));
204+ }
201205 }
206+ } catch (Exception e ) {
207+ DongTaiLog .error (e );
202208 }
203- } catch (Exception e ) {
204- DongTaiLog .error (e );
205209 }
210+ return modelValues ;
211+ }catch (Exception e ){
212+ return new HashSet <Object >();
206213 }
207- return modelValues ;
208214 }
209215
210216 private static boolean allowCall (MethodEvent event ) {
0 commit comments