File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
codeql-custom-queries-java Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,25 @@ module Bonus {
149149 }
150150 }
151151
152+ /* Step 1.2 */
153+ /** The type `javax.validation.ConstraintValidatorContext`. */
154+ class TypeConstraintValidatorContext extends RefType {
155+ TypeConstraintValidatorContext ( ) {
156+ this .hasQualifiedName ( "javax.validation" , "ConstraintValidatorContext" )
157+ }
158+ }
159+
160+ /**
161+ * A method named `buildConstraintViolationWithTemplate` declared on a subtype
162+ * of `javax.validation.ConstraintValidatorContext`.
163+ */
164+ class BuildConstraintViolationWithTemplateMethod extends Method {
165+ BuildConstraintViolationWithTemplateMethod ( ) {
166+ this .getDeclaringType ( ) .getASupertype * ( ) instanceof TypeConstraintValidatorContext and
167+ this .hasName ( "buildConstraintViolationWithTemplate" )
168+ }
169+ }
170+
152171predicate isSource ( DataFlow:: Node source ) {
153172 /* TODO describe source */
154173 //source.asExpr() instanceof StringLiteral
@@ -159,6 +178,14 @@ predicate isSource(DataFlow::Node source) {
159178 source instanceof BeanValidationSource
160179}
161180
181+ /* Step 1.2 */
182+ predicate isSink ( DataFlow:: Node sink ) {
183+ exists ( MethodAccess ma |
184+ ma .getMethod ( ) instanceof BuildConstraintViolationWithTemplateMethod and
185+ sink .asExpr ( ) = ma .getArgument ( 0 )
186+ )
187+ }
188+
162189// from Method method, MethodAccess call
163190// where
164191// call.getMethod() = method and
You can’t perform that action at this time.
0 commit comments