Skip to content

Commit 9f2897b

Browse files
committed
JS: Make VueRouterFlowSource a subclass of ClientSideRemoteFlowSource
1 parent 38f763d commit 9f2897b

File tree

1 file changed

+18
-6
lines changed
  • javascript/ql/src/semmle/javascript/frameworks

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,16 +656,28 @@ module Vue {
656656
/** Gets a data flow node that refers to a `Route` object from `vue-router`. */
657657
DataFlow::SourceNode routeObject() { result = routeObject(DataFlow::TypeTracker::end()) }
658658

659-
private class VueRouterFlowSource extends RemoteFlowSource {
659+
private class VueRouterFlowSource extends ClientSideRemoteFlowSource {
660+
ClientSideRemoteFlowKind kind;
661+
660662
VueRouterFlowSource() {
661-
this = routeObject().getAPropertyRead(["params", "query", "hash", "path", "fullPath"])
662-
or
663-
exists(Instance i, string prop |
664-
this = i.getWatchHandler(prop).getParameter([0, 1]) and
665-
prop.regexpMatch("\\$route\\.(params|query|hash|path|fullPath)\\b.*")
663+
exists(string name |
664+
this = routeObject().getAPropertyRead(name)
665+
or
666+
exists(string prop |
667+
this = any(Instance i).getWatchHandler(prop).getParameter([0, 1]) and
668+
name = prop.regexpCapture("\\$route\\.(params|query|hash|path|fullPath)\\b.*", 1)
669+
)
670+
|
671+
name = ["params", "path", "fullPath"] and kind.isPath()
672+
or
673+
name = "query" and kind.isQuery()
674+
or
675+
name = "hash" and kind.isFragment()
666676
)
667677
}
668678

669679
override string getSourceType() { result = "Vue route parameter" }
680+
681+
override ClientSideRemoteFlowKind getKind() { result = kind }
670682
}
671683
}

0 commit comments

Comments
 (0)