@@ -16,8 +16,14 @@ import codeql.swift.dataflow.DataFlow
16
16
import codeql.swift.dataflow.TaintTracking
17
17
import DataFlow:: PathGraph
18
18
19
+ /**
20
+ * An `Expr` that is stored in a local database.
21
+ */
19
22
abstract class Stored extends Expr { }
20
23
24
+ /**
25
+ * An `Expr` that is stored with the Core Data library.
26
+ */
21
27
class CoreDataStore extends Stored {
22
28
CoreDataStore ( ) {
23
29
// `content` arg to `NWConnection.send` is a sink
@@ -31,6 +37,31 @@ class CoreDataStore extends Stored {
31
37
}
32
38
}
33
39
40
+ /**
41
+ * An `Expr` that is stored with the Realm database library.
42
+ */
43
+ class RealmStore extends Stored {
44
+ RealmStore ( ) {
45
+ // `object` arg to `Realm.add` is a sink
46
+ exists ( ClassDecl c , AbstractFunctionDecl f , CallExpr call |
47
+ c .getName ( ) = "Realm" and
48
+ c .getAMember ( ) = f and
49
+ f .getName ( ) = [ "add(_:update:)" ] and
50
+ call .getFunction ( ) .( ApplyExpr ) .getStaticTarget ( ) = f and
51
+ call .getArgument ( 0 ) .getExpr ( ) = this
52
+ )
53
+ or
54
+ // `value` arg to `Realm.create` is a sink
55
+ exists ( ClassDecl c , AbstractFunctionDecl f , CallExpr call |
56
+ c .getName ( ) = "Realm" and
57
+ c .getAMember ( ) = f and
58
+ f .getName ( ) = [ "create(_:value:update:)" ] and
59
+ call .getFunction ( ) .( ApplyExpr ) .getStaticTarget ( ) = f and
60
+ call .getArgument ( 1 ) .getExpr ( ) = this
61
+ )
62
+ }
63
+ }
64
+
34
65
/**
35
66
* A taint configuration from sensitive information to expressions that are
36
67
* transmitted over a network.
0 commit comments