@@ -97,7 +97,7 @@ abstract class TaintTransferringMethod extends Method {
9797 * Holds if this method writes tainted data to `sink` when `src` is tainted.
9898 * `src` and `sink` are parameter indices, or -1 to indicate the qualifier.
9999 */
100- predicate transfersTaint ( int src , int sink ) { none ( ) }
100+ abstract predicate transfersTaint ( int src , int sink ) ;
101101}
102102
103103private class StringTaintPreservingMethod extends TaintPreservingMethod {
@@ -429,14 +429,6 @@ private predicate taintPreservingQualifierToMethod(Method m) {
429429 )
430430 )
431431 or
432- m .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeSQLiteQueryBuilder and
433- // buildQuery(String[] projectionIn, String selection, String groupBy, String having, String sortOrder, String limit)
434- // buildQuery(String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String sortOrder, String limit)
435- // buildUnionQuery(String[] subQueries, String sortOrder, String limit)
436- // buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set<String> columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String[] selectionArgs, String groupBy, String having)
437- // buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set<String> columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String groupBy, String having)
438- m .hasName ( [ "buildQuery" , "buildUnionQuery" , "buildUnionSubQuery" ] )
439- or
440432 m .( TaintPreservingMethod ) .returnsTaint ( - 1 )
441433}
442434
@@ -470,12 +462,6 @@ private predicate argToMethodStep(Expr tracked, MethodAccess sink) {
470462 tracked = sink .getArgument ( i )
471463 )
472464 or
473- exists ( MethodAccess ma |
474- taintPreservingArgumentToMethod ( ma .getMethod ( ) ) and
475- tracked = ma .getAnArgument ( ) and
476- sink = ma
477- )
478- or
479465 exists ( Method springResponseEntityOfOk |
480466 sink .getMethod ( ) = springResponseEntityOfOk and
481467 springResponseEntityOfOk .getDeclaringType ( ) instanceof SpringResponseEntity and
@@ -493,23 +479,6 @@ private predicate argToMethodStep(Expr tracked, MethodAccess sink) {
493479 )
494480}
495481
496- /**
497- * Holds if `method` is a library method that returns tainted data if any
498- * of its arguments are tainted.
499- */
500- private predicate taintPreservingArgumentToMethod ( Method method ) {
501- method .getDeclaringType ( ) instanceof TypeDatabaseUtils and
502- // String[] appendSelectionArgs(String[] originalValues, String[] newValues)
503- // String concatenateWhere(String a, String b)
504- method .hasName ( [ "appendSelectionArgs" , "concatenateWhere" ] )
505- or
506- method .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeSQLiteQueryBuilder and
507- // buildQuery(String[] projectionIn, String selection, String groupBy, String having, String sortOrder, String limit)
508- // buildQuery(String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String sortOrder, String limit)
509- // buildUnionQuery(String[] subQueries, String sortOrder, String limit)
510- method .hasName ( [ "buildQuery" , "buildUnionQuery" ] )
511- }
512-
513482/**
514483 * Holds if `method` is a library method that returns tainted data if its
515484 * `arg`th argument is tainted.
@@ -611,18 +580,6 @@ private predicate taintPreservingArgumentToMethod(Method method, int arg) {
611580 method .hasName ( "append" ) and
612581 arg = 0
613582 or
614- method .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeSQLiteQueryBuilder and
615- (
616- // static buildQueryString(boolean distinct, String tables, String[] columns, String where, String groupBy, String having, String orderBy, String limit)
617- method .hasName ( "buildQueryString" ) and arg = [ 1 .. method .getNumberOfParameters ( ) ]
618- or
619- // buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set<String> columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String[] selectionArgs, String groupBy, String having)
620- // buildUnionSubQuery(String typeDiscriminatorColumn, String[] unionColumns, Set<String> columnsPresentInTable, int computedColumnsOffset, String typeDiscriminatorValue, String selection, String groupBy, String having)
621- method .hasName ( "buildUnionSubQuery" ) and
622- arg = [ 0 .. method .getNumberOfParameters ( ) ] and
623- arg != 3
624- )
625- or
626583 (
627584 method .getDeclaringType ( ) instanceof AndroidContentProvider or
628585 method .getDeclaringType ( ) instanceof AndroidContentResolver
@@ -680,12 +637,6 @@ private predicate taintPreservingArgToArg(Method method, int input, int output)
680637 input = 0 and
681638 output = 2
682639 or
683- method .getDeclaringType ( ) instanceof TypeSQLiteQueryBuilder and
684- // static appendColumns(StringBuilder s, String[] columns)
685- method .hasName ( "appendColumns" ) and
686- input = 1 and
687- output = 0
688- or
689640 method .( TaintTransferringMethod ) .transfersTaint ( input , output )
690641}
691642
@@ -725,14 +676,6 @@ private predicate taintPreservingArgumentToQualifier(Method method, int arg) {
725676 append .getDeclaringType ( ) .hasQualifiedName ( "java.io" , "StringWriter" )
726677 )
727678 or
728- method .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeSQLiteQueryBuilder and
729- // setProjectionMap(Map<String, String> columnMap)
730- // setTables(String inTables)
731- // appendWhere(CharSequence inWhere)
732- // appendWhereStandalone(CharSequence inWhere)
733- method .hasName ( [ "setProjectionMap" , "setTables" , "appendWhere" , "appendWhereStandalone" ] ) and
734- arg = 0
735- or
736679 method .( TaintTransferringMethod ) .transfersTaint ( arg , - 1 )
737680}
738681
0 commit comments