@@ -65,6 +65,11 @@ private class LocalDatabaseInputStoreMethod extends Method {
6565 }
6666}
6767
68+ /**
69+ * Holds if `input` is a value being prepared for being stored into the SQLite dataabse `database`.
70+ * This can be done using prepared statements, using the class `ContentValues`, or directly
71+ * appending `input` to a SQL query.
72+ */
6873private predicate localDatabaseInput ( DataFlow:: Node database , Argument input ) {
6974 exists ( Method m | input .getCall ( ) .getCallee ( ) = m |
7075 m instanceof LocalDatabaseInputStoreMethod and
@@ -81,6 +86,11 @@ private predicate localDatabaseInput(DataFlow::Node database, Argument input) {
8186 )
8287}
8388
89+ /**
90+ * Holds if `store` is a method call for storing a previously appended input value,
91+ * either through the use of prepared statements, via the `ContentValues` class, or
92+ * directly executing a raw SQL query.
93+ */
8494private predicate localDatabaseStore ( DataFlow:: Node database , MethodAccess store ) {
8595 exists ( Method m | store .getMethod ( ) = m |
8696 m instanceof LocalDatabaseInputStoreMethod and
@@ -110,6 +120,8 @@ private class LocalDatabaseFlowConfig extends DataFlow::Configuration {
110120 }
111121
112122 override predicate isAdditionalFlowStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
123+ // Adds a step for tracking databases through field flow, that is, a database is opened and
124+ // assigned to a field, and then an input or store method is called on that field elsewhere.
113125 exists ( Field f |
114126 f .getType ( ) instanceof TypeSQLiteDatabase and
115127 f .getAnAssignedValue ( ) = n1 .asExpr ( ) and
0 commit comments