Skip to content

Commit 076e4a4

Browse files
committed
JS: Mark AngularJS $location as client-side remote flow source
1 parent 860b3d7 commit 076e4a4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

javascript/ql/lib/semmle/javascript/frameworks/AngularJS/AngularJSCore.qll

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,20 +550,25 @@ class DirectiveTargetName extends string {
550550
*
551551
* See https://docs.angularjs.org/api/ng/service/$location for details.
552552
*/
553-
private class LocationFlowSource extends RemoteFlowSource instanceof DataFlow::MethodCallNode {
553+
private class LocationFlowSource extends ClientSideRemoteFlowSource instanceof DataFlow::MethodCallNode
554+
{
555+
private ClientSideRemoteFlowKind kind;
556+
554557
LocationFlowSource() {
555558
exists(ServiceReference service, string m, int n |
556559
service.getName() = "$location" and
557560
this = service.getAMethodCall(m) and
558561
n = super.getNumArgument()
559562
|
560-
m = "search" and n < 2
563+
m = "search" and n < 2 and kind.isQuery()
561564
or
562-
m = "hash" and n = 0
565+
m = "hash" and n = 0 and kind.isFragment()
563566
)
564567
}
565568

566569
override string getSourceType() { result = "$location" }
570+
571+
override ClientSideRemoteFlowKind getKind() { result = kind }
567572
}
568573

569574
/**

0 commit comments

Comments
 (0)