@@ -45,8 +45,12 @@ predicate isSourceImpl(DataFlow::Node source, SensitiveExpr sensitive) {
4545}
4646
4747/** Holds if `sink` is an argument to an Sqlite function call `c`. */
48- predicate isSinkImpl ( DataFlow:: Node sink , SqliteFunctionCall c ) {
49- [ sink .asExpr ( ) , sink .asIndirectExpr ( ) ] = c .getASource ( )
48+ predicate isSinkImpl ( DataFlow:: Node sink , SqliteFunctionCall c , Type t ) {
49+ exists ( Expr e |
50+ e = c .getASource ( ) and
51+ e = [ sink .asExpr ( ) , sink .asIndirectExpr ( ) ] and
52+ t = e .getUnspecifiedType ( )
53+ )
5054}
5155
5256/**
@@ -58,7 +62,7 @@ class FromSensitiveConfiguration extends TaintTracking::Configuration {
5862 override predicate isSource ( DataFlow:: Node source ) { isSourceImpl ( source , _) }
5963
6064 override predicate isSink ( DataFlow:: Node sink ) {
61- isSinkImpl ( sink , _) and
65+ isSinkImpl ( sink , _, _ ) and
6266 not sqlite_encryption_used ( )
6367 }
6468
@@ -68,15 +72,11 @@ class FromSensitiveConfiguration extends TaintTracking::Configuration {
6872
6973 override predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet content ) {
7074 // flow out from fields at the sink (only).
71- this .isSink ( node ) and
7275 // constrain `content` to a field inside the node.
73- exists ( Class c |
74- node . getType ( ) . getUnspecifiedType ( ) . stripType ( ) = c and
75- content .( DataFlow:: FieldContent ) .getField ( ) = getRecField ( c )
76+ exists ( Type t |
77+ isSinkImpl ( node , _ , t ) and
78+ content .( DataFlow:: FieldContent ) .getField ( ) = getRecField ( t . stripType ( ) )
7679 )
77- or
78- // any default implicit reads
79- super .allowImplicitRead ( node , content )
8080 }
8181}
8282
8686where
8787 config .hasFlowPath ( source , sink ) and
8888 isSourceImpl ( source .getNode ( ) , sensitive ) and
89- isSinkImpl ( sink .getNode ( ) , sqliteCall )
89+ isSinkImpl ( sink .getNode ( ) , sqliteCall , _ )
9090select sqliteCall , source , sink ,
9191 "This SQLite call may store $@ in a non-encrypted SQLite database." , sensitive ,
9292 "sensitive information"
0 commit comments