Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -550,20 +550,25 @@ class DirectiveTargetName extends string {
*
* See https://docs.angularjs.org/api/ng/service/$location for details.
*/
private class LocationFlowSource extends RemoteFlowSource instanceof DataFlow::MethodCallNode {
private class LocationFlowSource extends ClientSideRemoteFlowSource instanceof DataFlow::MethodCallNode
{
private ClientSideRemoteFlowKind kind;
Copy link

Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kind field is never assigned, so calls to kind.isQuery() or kind.isFragment() will fail. Assign kind = ClientSideRemoteFlowKind.Query when m == "search" and kind = ClientSideRemoteFlowKind.Fragment when m == "hash`.

Copilot uses AI. Check for mistakes.

LocationFlowSource() {
exists(ServiceReference service, string m, int n |
service.getName() = "$location" and
this = service.getAMethodCall(m) and
n = super.getNumArgument()
|
m = "search" and n < 2
m = "search" and n < 2 and kind.isQuery()
or
m = "hash" and n = 0
m = "hash" and n = 0 and kind.isFragment()
)
}

override string getSourceType() { result = "$location" }

override ClientSideRemoteFlowKind getKind() { result = kind }
}

/**
Expand Down