Skip to content

Commit 0eb9231

Browse files
committed
JS: Make use of TypeTracker::end()
1 parent 208bcd4 commit 0eb9231

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

javascript/ql/src/semmle/javascript/frameworks/Firebase.qll

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Firebase {
2222

2323
/** Gets a reference to the `firebase/app` or `firebase-admin` API object. */
2424
DataFlow::SourceNode firebase() {
25-
result = firebase(_)
25+
result = firebase(DataFlow::TypeTracker::end())
2626
}
2727

2828
/** Gets a reference to a Firebase app created with `initializeApp`. */
@@ -39,7 +39,7 @@ module Firebase {
3939
* app created explicitly with `initializeApp()`.
4040
*/
4141
DataFlow::SourceNode app() {
42-
result = firebase(_) or result = initApp(_)
42+
result = firebase(DataFlow::TypeTracker::end()) or result = initApp(DataFlow::TypeTracker::end())
4343
}
4444

4545
module Database {
@@ -55,7 +55,7 @@ module Firebase {
5555

5656
/** Gets a reference to a Firebase database object, such as `firebase.database()`. */
5757
DataFlow::SourceNode database() {
58-
result = database(_)
58+
result = database(DataFlow::TypeTracker::end())
5959
}
6060

6161
/** Gets a node that refers to a `Reference` object, such as `firebase.database().ref()`. */
@@ -67,12 +67,12 @@ module Firebase {
6767
name = "refFromURL"
6868
)
6969
or
70-
exists (string name | result = ref(_).getAMethodCall(name) |
70+
exists (string name | result = ref().getAMethodCall(name) |
7171
name = "push" or
7272
name = "child"
7373
)
7474
or
75-
exists (string name | result = ref(_).getAPropertyRead(name) |
75+
exists (string name | result = ref().getAPropertyRead(name) |
7676
name = "parent" or
7777
name = "root"
7878
)
@@ -87,7 +87,7 @@ module Firebase {
8787

8888
/** Gets a node that refers to a `Reference` object, such as `firebase.database().ref()`. */
8989
DataFlow::SourceNode ref() {
90-
result = ref(_)
90+
result = ref(DataFlow::TypeTracker::end())
9191
}
9292

9393
/** Gets a node that refers to a `Query` or `Reference` object. */
@@ -96,7 +96,7 @@ module Firebase {
9696
(
9797
result = ref(t) // a Reference can be used as a Query
9898
or
99-
exists (string name | result = query(_).getAMethodCall(name) |
99+
exists (string name | result = query().getAMethodCall(name) |
100100
name = "endAt" or
101101
name = "limitTo" + any(string s) or
102102
name = "orderBy" + any(string s) or
@@ -111,7 +111,7 @@ module Firebase {
111111

112112
/** Gets a node that refers to a `Query` or `Reference` object. */
113113
DataFlow::SourceNode query() {
114-
result = query(_)
114+
result = query(DataFlow::TypeTracker::end())
115115
}
116116

117117
/**
@@ -147,7 +147,7 @@ module Firebase {
147147
* Gets a node that is passed as the callback to a `Reference.transaction` call.
148148
*/
149149
DataFlow::SourceNode transactionCallback() {
150-
result = transactionCallback(_)
150+
result = transactionCallback(DataFlow::TypeBackTracker::end())
151151
}
152152
}
153153

@@ -168,7 +168,7 @@ module Firebase {
168168

169169
/** Gets a reference to the Cloud Functions namespace. */
170170
DataFlow::SourceNode namespace() {
171-
result = namespace(_)
171+
result = namespace(DataFlow::TypeTracker::end())
172172
}
173173

174174
/** Gets a reference to a Cloud Functions database object. */
@@ -183,7 +183,7 @@ module Firebase {
183183

184184
/** Gets a reference to a Cloud Functions database object. */
185185
DataFlow::SourceNode database() {
186-
result = database(_)
186+
result = database(DataFlow::TypeTracker::end())
187187
}
188188

189189
/** Gets a data flow node holding a `RefBuilder` object. */
@@ -198,7 +198,7 @@ module Firebase {
198198

199199
/** Gets a data flow node holding a `RefBuilder` object. */
200200
DataFlow::SourceNode ref() {
201-
result = refBuilder(_)
201+
result = refBuilder(DataFlow::TypeTracker::end())
202202
}
203203

204204
/** Gets a call that registers a listener on a `RefBuilder`, such as `ref.onCreate(...)`. */
@@ -237,7 +237,7 @@ module Firebase {
237237
* Gets a value that will be invoked with a `DataSnapshot` value as its first parameter.
238238
*/
239239
DataFlow::SourceNode snapshotCallback() {
240-
result = snapshotCallback(_)
240+
result = snapshotCallback(DataFlow::TypeBackTracker::end())
241241
}
242242

243243
/**
@@ -251,11 +251,11 @@ module Firebase {
251251
or
252252
result instanceof Database::QueryListenCall // returns promise
253253
or
254-
result = snapshot(_).getAMethodCall("child")
254+
result = snapshot().getAMethodCall("child")
255255
or
256-
result = snapshot(_).getAMethodCall("forEach").getCallback(0).getParameter(0)
256+
result = snapshot().getAMethodCall("forEach").getCallback(0).getParameter(0)
257257
or
258-
exists (string prop | result = snapshot(_).getAPropertyRead(prop) |
258+
exists (string prop | result = snapshot().getAPropertyRead(prop) |
259259
prop = "before" or // only defined on Change objects
260260
prop = "after"
261261
)
@@ -273,7 +273,7 @@ module Firebase {
273273
* `firebase.database().ref().on('value', x => {...})`.
274274
*/
275275
DataFlow::SourceNode snapshot() {
276-
result = snapshot(_)
276+
result = snapshot(DataFlow::TypeTracker::end())
277277
}
278278

279279
/**

0 commit comments

Comments
 (0)