@@ -27,11 +27,10 @@ class ELMessageInterpolatorType extends RefType {
2727}
2828
2929/**
30- * A method call that sets the application's default message interpolator to an interpolator type that is likely to be safe,
31- * because it does not process Java Expression Language expressions.
30+ * A method call that sets the application's default message interpolator.
3231 */
33- class SetSafeMessageInterpolatorCall extends MethodAccess {
34- SetSafeMessageInterpolatorCall ( ) {
32+ class SetMessageInterpolatorCall extends MethodAccess {
33+ SetMessageInterpolatorCall ( ) {
3534 exists ( Method m , RefType t |
3635 this .getMethod ( ) = m and
3736 m .getDeclaringType ( ) .getASourceSupertype * ( ) = t and
@@ -44,7 +43,13 @@ class SetSafeMessageInterpolatorCall extends MethodAccess {
4443 [ "CustomValidatorBean" , "LocalValidatorFactoryBean" ] ) and
4544 m .getName ( ) = "setMessageInterpolator"
4645 )
47- ) and
46+ )
47+ }
48+
49+ /**
50+ * The message interpolator is likely to be safe, because it does not process Java Expression Language expressions.
51+ */
52+ predicate isSafe ( ) {
4853 not this .getAnArgument ( ) .getType ( ) instanceof ELMessageInterpolatorType
4954 }
5055}
@@ -82,7 +87,7 @@ class BeanValidationConfig extends TaintTracking::Configuration {
8287
8388from BeanValidationConfig cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink
8489where
85- not exists ( SetSafeMessageInterpolatorCall ma ) and
90+ not forall ( SetMessageInterpolatorCall c | c . isSafe ( ) ) and
8691 cfg .hasFlowPath ( source , sink )
8792select sink .getNode ( ) , source , sink ,
8893 "Custom constraint error message contains unsanitized user data"
0 commit comments