Skip to content

Commit 8016715

Browse files
authored
Python: Add missing QLDoc
1 parent 3869ab7 commit 8016715

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

python/ql/src/semmle/python/dataflow/new/TypeTracker.qll

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@ class AttributeName = Internal::ContentName;
1212
/** Either an attribute name, or the empty string (representing no attribute). */
1313
class OptionalAttributeName = Internal::OptionalContentName;
1414

15+
/**
16+
* Summary of the steps needed to track a value to a given dataflow node.
17+
*
18+
* This can be used to track objects that implement a certain API in order to
19+
* recognize calls to that API. Note that type-tracking does not by itself provide a
20+
* source/sink relation, that is, it may determine that a node has a given type,
21+
* but it won't determine where that type came from.
22+
*
23+
* It is recommended that all uses of this type are written in the following form,
24+
* for tracking some type `myType`:
25+
* ```ql
26+
* DataFlow::LocalSourceNode myType(DataFlow::TypeTracker t) {
27+
* t.start() and
28+
* result = < source of myType >
29+
* or
30+
* exists (DataFlow::TypeTracker t2 |
31+
* result = myType(t2).track(t2, t)
32+
* )
33+
* }
34+
*
35+
* DataFlow::LocalSourceNode myType() { myType(DataFlow::TypeTracker::end()) }
36+
* ```
37+
*
38+
* Instead of `result = myType(t2).track(t2, t)`, you can also use the equivalent
39+
* `t = t2.step(myType(t2), result)`. If you additionally want to track individual
40+
* intra-procedural steps, use `t = t2.smallstep(myCallback(t2), result)`.
41+
*/
1542
class TypeTracker extends Internal::TypeTracker {
1643
/**
1744
* Holds if this is the starting point of type tracking, and the value starts in the attribute named `attrName`.

0 commit comments

Comments
 (0)