File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
javascript/ql/lib/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ private module MongoDB {
29
29
private API:: Node getAMongoClient ( ) {
30
30
result = API:: moduleImport ( "mongodb" ) .getMember ( "MongoClient" )
31
31
or
32
- result = getAMongoDbCallback ( ) .getParameter ( 1 ) and
33
- not result .getAnImmediateUse ( ) .( DataFlow:: ParameterNode ) .getName ( ) = "db" // mongodb v2 provides a `Db` here
32
+ // The callback parameter is either a MongoClient or Db depending on the mongodb package version,
33
+ // but we just model it as both.
34
+ result = getAMongoDbCallback ( ) .getParameter ( 1 )
34
35
}
35
36
36
37
/** Gets an API-graph node that refers to a `connect` callback. */
@@ -44,8 +45,9 @@ private module MongoDB {
44
45
private API:: Node getAMongoDb ( ) {
45
46
result = getAMongoClient ( ) .getMember ( "db" ) .getReturn ( )
46
47
or
47
- result = getAMongoDbCallback ( ) .getParameter ( 1 ) and
48
- not result .getAnImmediateUse ( ) .( DataFlow:: ParameterNode ) .getName ( ) = "client" // mongodb v3 provides a `Mongoclient` here
48
+ // The callback parameter is either a MongoClient or Db depending on the mongodb package version,
49
+ // but we just model it as both.
50
+ result = getAMongoDbCallback ( ) .getParameter ( 1 )
49
51
}
50
52
51
53
/** Gets a data flow node referring to a MongoDB collection. */
You can’t perform that action at this time.
0 commit comments