@@ -23,20 +23,20 @@ class ELMessageInterpolatorType extends RefType {
2323 }
2424}
2525
26- class SetSafeMessageInterpolator extends MethodAccess {
27- SetSafeMessageInterpolator ( ) {
28- exists ( Method m |
26+ /**
27+ * A method call that sets the application's default message interpolator to an interpolator type that is likely to be safe,
28+ * because it does not process Java Expression Language expressions.
29+ */
30+ class SetSafeMessageInterpolatorCall extends MethodAccess {
31+ SetSafeMessageInterpolatorCall ( ) {
32+ exists ( Method m , RefType t |
2933 this .getMethod ( ) = m and
34+ m .getDeclaringType ( ) .getASourceSupertype * ( ) = t and
3035 (
31- m
32- .getDeclaringType ( )
33- .getASourceSupertype * ( )
34- .hasQualifiedName ( "javax.validation" , [ "Configuration" , "ValidatorContext" ] ) and
36+ t .hasQualifiedName ( "javax.validation" , [ "Configuration" , "ValidatorContext" ] ) and
3537 m .getName ( ) = "messageInterpolator"
3638 or
37- m
38- .getDeclaringType ( )
39- .getASourceSupertype * ( )
39+ t
4040 .hasQualifiedName ( "org.springframework.validation.beanvalidation" ,
4141 [ "CustomValidatorBean" , "LocalValidatorFactoryBean" ] ) and
4242 m .getName ( ) = "setMessageInterpolator"
@@ -71,7 +71,7 @@ class BeanValidationConfig extends TaintTracking::Configuration {
7171
7272from BeanValidationConfig cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink
7373where
74- not exists ( SetSafeMessageInterpolator ma ) and
74+ not exists ( SetSafeMessageInterpolatorCall ma ) and
7575 cfg .hasFlowPath ( source , sink )
7676select sink .getNode ( ) , source , sink ,
7777 "Custom constraint error message contains unsanitized user data"
0 commit comments