CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.9.0 (changelog, source)
Search

Module CallGraph

Provides predicates for visualizing the call paths leading to or from a specific function.

It defines three predicates: callEdge, isStartOfCallPath and isEndOfCallPath, as well as the nodes and edges predicates needed for a path problem query.

To use this library, make sure the query has @kind path-problem and selects columns appropriate for a path problem query. For example:

import javascript
import semmle.javascript.explore.CallGraph
import DataFlow

from InvokeNode invoke, FunctionNode function
where callEdge*(invoke, function)
  and isStartOfCallPath(invoke)
  and function.getName() = "targetFunction"
select invoke, invoke, function, "Call path to 'targetFunction'"

NOTE: This library should only be used for debugging and exploration, not in production code.

Import path

import semmle.javascript.explore.CallGraph

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Predicates

callEdge

Holds if pred -> succ is an edge in the call graph.

isEndOfCallPath

Holds if fun should be used as the end point of a call path.

isStartOfCallPath

Holds if invoke should be used as the starting point of a call path.

nodes

Holds if node is part of the call graph.

Aliases

edges

Holds if pred -> succ is an edge in the call graph.