CodeQL library for Python
codeql/python-all 0.11.13 (changelog, source)
Search

Class TypeTracker

DEPRECATED: Use semmle.python.dataflow.new.TypeTracking instead.

A summary of the steps needed to track a value to a given dataflow node.

This can be used to track objects that implement a certain API in order to recognize calls to that API. Note that type-tracking does not by itself provide a source/sink relation, that is, it may determine that a node has a given type, but it won’t determine where that type came from.

It is recommended that all uses of this type are written in the following form, for tracking some type myType:

DataFlow::TypeTrackingNode myType(DataFlow::TypeTracker t) {
  t.start() and
  result = < source of myType >
  or
  exists (DataFlow::TypeTracker t2 |
    result = myType(t2).track(t2, t)
  )
}

DataFlow::Node myType() { myType(DataFlow::TypeTracker::end()).flowsTo(result) }

Instead of result = myType(t2).track(t2, t), you can also use the equivalent t = t2.step(myType(t2), result). If you additionally want to track individual intra-procedural steps, use t = t2.smallstep(myCallback(t2), result).

Import path

import semmle.python.dataflow.new.internal.TypeTracker

Direct supertypes

Known direct subtypes

Fields

Predicates

append

Gets the summary resulting from appending step to this type-tracking summary.

call

Holds if this is the starting point of type tracking when tracking a parameter into a call, but not out of it.

continue

Gets a type tracker that starts where this one has left off to allow continued tracking.

end

Holds if this is the end point of type tracking.

getContent

INTERNAL. DO NOT USE.

hasCall

INTERNAL. DO NOT USE.

smallstep

Gets the summary that corresponds to having taken a forwards local, heap and/or inter-procedural step from nodeFrom to nodeTo.

start

Holds if this is the starting point of type tracking.

startInContent

Holds if this is the starting point of type tracking, and the value starts in the content named contentName. The type tracking only ends after the content has been loaded.

step

Gets the summary that corresponds to having taken a forwards heap and/or inter-procedural step from nodeFrom to nodeTo.

toString

Gets a textual representation of this summary.

Charpred