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

Member predicate API::Node::asSink

Gets a data-flow node where this value leaves the current codebase and flows into an external library (or in general, any external codebase).

Concretely, this is either an argument passed to a call to external code, or the right-hand side of an attribute write on an object flowing into such a call.

For example:

import foo

# 'x' is matched by API::moduleImport("foo").getMember("bar").getParameter(0).asSink()
foo.bar(x)

# 'x' is matched by API::moduleImport("foo").getMember("bar").getParameter(0).getMember("prop").asSink()
obj.prop = x
foo.bar(obj);

This predicate does not include nodes transitively reaching the sink by data flow; use getAValueReachingSink for that.

Node asSink()