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

Class LocalSourceNode

A data flow node that is a source of local flow. This includes things like

  • Expressions
  • Function parameters

Local source nodes and the flowsTo relation should be thought of in terms of the reference semantics of the underlying object. For instance, in the following snippet of code

    x = []
    x.append(1)
    x.append(2)

the local source node corresponding to the occurrences of x is the empty list that is assigned to x originally. Even though the two append calls modify the value of x, they do not change the fact that x still points to the same object. If, however, we next do x = x + [3], then the expression x + [3] will be the new local source of what x now points to.

Import path

import semmle.python.dataflow.new.internal.LocalSources

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

backtrack

Gets a node that may flow into this one using one heap and/or interprocedural step.

flowsTo

Holds if this LocalSourceNode can flow to nodeTo in one or more local flow steps.

getACall

Gets a call to this node.

getAMethodCall

Gets a call to the method methodName on this node.

getAnAttributeRead

Gets a read of attribute attrName on this node.

getAnAttributeRead

Gets a read of any attribute on this node.

getAnAttributeReference

Gets a reference (read or write) of attribute attrName on this node.

getAnAttributeReference

Gets a reference (read or write) of any attribute on this node.

getAnAttributeWrite

Gets a write of attribute attrName on this node.

getAnAttributeWrite

Gets a write of any attribute on this node.

getAnAwaited

Gets an awaited value from this node.

getSubscript

Gets a subscript of this node.

track

Gets a node that this node may flow to using one heap and/or interprocedural step.

Inherited predicates

asCfgNode

Gets the control-flow node corresponding to this node, if any.

from Node
asExpr

Gets the expression corresponding to this node, if any.

from Node
asVar

Gets the ESSA variable corresponding to this node, if any.

from Node
getALocalSource

Gets a local source node from which data may flow to this node in zero or more local data-flow steps.

from Node
getEnclosingCallable

Gets the enclosing callable of this node.

from Node
getLocation

Gets the location of this node

from Node
getScope

Gets the scope of this node.

from Node
hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

from Node
toString

Gets a textual representation of this element.

from Node

Charpred