Skip to content

Commit ad592d7

Browse files
committed
JS: handle .after and .before
1 parent 0401b26 commit ad592d7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ module Firebase {
238238
}
239239

240240
/**
241-
* Gets a node that refers to a `DataSnapshot` value or a promise thereof.
241+
* Gets a node that refers to a `DataSnapshot` value or a promise or `Change`
242+
* object containing `DataSnapshot`s.
242243
*/
243244
DataFlow::SourceNode snapshot(DataFlow::TypeTracker t) {
244245
t.start() and
@@ -250,6 +251,11 @@ module Firebase {
250251
result = snapshot(_).getAMethodCall("child")
251252
or
252253
result = snapshot(_).getAMethodCall("forEach").getCallback(0).getParameter(0)
254+
or
255+
exists (string prop | result = snapshot(_).getAPropertyRead(prop) |
256+
prop = "before" or // only defined on Change objects
257+
prop = "after"
258+
)
253259
)
254260
or
255261
promiseTaintStep(snapshot(t), result)

0 commit comments

Comments
 (0)