Skip to content

Commit 3eb4866

Browse files
committed
update Express::RouterDefinition to a DataFlow::InvokeNode
1 parent 9224038 commit 3eb4866

File tree

1 file changed

+6
-15
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+6
-15
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Express.qll

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module Express {
8484
private class RouterRange extends Routing::Router::Range {
8585
RouterDefinition def;
8686

87-
RouterRange() { this = def.flow() }
87+
RouterRange() { this = def }
8888

8989
override DataFlow::SourceNode getAReference() { result = def.ref() }
9090
}
@@ -878,20 +878,17 @@ module Express {
878878
* Gets a route handler of the application, regardless of nesting.
879879
*/
880880
override HTTP::RouteHandler getARouteHandler() {
881-
result = this.asExpr().(RouterDefinition).getASubRouter*().getARouteHandler()
881+
result = this.(RouterDefinition).getASubRouter*().getARouteHandler()
882882
}
883883
}
884884

885-
/**
886-
* An Express router.
887-
*/
888-
class RouterDefinition extends InvokeExpr {
889-
// TODO: DataFlow::Node
890-
RouterDefinition() { this = routerCreation().asExpr() }
885+
/** An Express router. */
886+
class RouterDefinition extends DataFlow::Node instanceof DataFlow::InvokeNode {
887+
RouterDefinition() { this = routerCreation() }
891888

892889
private DataFlow::SourceNode ref(DataFlow::TypeTracker t) {
893890
t.start() and
894-
result = DataFlow::exprNode(this)
891+
result = this
895892
or
896893
exists(string name | result = this.ref(t.continue()).getAMethodCall(name) |
897894
name = "route" or
@@ -904,12 +901,6 @@ module Express {
904901
/** Gets a data flow node referring to this router. */
905902
DataFlow::SourceNode ref() { result = this.ref(DataFlow::TypeTracker::end()) }
906903

907-
/**
908-
* DEPRECATED: Use `ref().flowsToExpr()` instead.
909-
* Holds if `sink` may refer to this router.
910-
*/
911-
deprecated predicate flowsTo(Expr sink) { this.ref().flowsToExpr(sink) }
912-
913904
/**
914905
* Gets a `RouteSetup` that was used for setting up a route on this router.
915906
*/

0 commit comments

Comments
 (0)