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

Class TypeTracker

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

The 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::LocalSourceNode myType() { myType(DataFlow::TypeTracker::end()) }

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.TypeTracker

Direct supertypes

Indirect supertypes

Inherited fields

Predicates

getAttr

INTERNAL. DO NOT USE.

startInAttr

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

Inherited predicates

append

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

from TypeTracker
call

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

from TypeTracker
continue

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

from TypeTracker
end

Holds if this is the end point of type tracking.

from TypeTracker
getContent

INTERNAL. DO NOT USE.

from TypeTracker
hasCall

INTERNAL. DO NOT USE.

from TypeTracker
smallstep

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

from TypeTracker
start

Holds if this is the starting point of type tracking.

from TypeTracker
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.

from TypeTracker
step

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

from TypeTracker
toString

Gets a textual representation of this summary.

from TypeTracker