Skip to content

Commit 09fa2a7

Browse files
authored
Move imports to usage sections
1 parent 94e9848 commit 09fa2a7

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

docs/codeql/codeql-language-guides/analyzing-data-flow-in-java.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ The following sections describe how to use the libraries for local data flow, gl
1717

1818
For a more general introduction to modeling data flow, see ":ref:`About data flow analysis <about-data-flow-analysis>`."
1919

20-
For data flow you need the following import:
21-
22-
.. code-block:: ql
23-
24-
import semmle.code.java.dataflow.DataFlow
25-
26-
For taint tracking you need this import:
27-
28-
.. code-block:: ql
29-
30-
import semmle.code.java.dataflow.TaintTracking
31-
3220
Local data flow
3321
---------------
3422

@@ -37,7 +25,13 @@ Local data flow is data flow within a single method or callable. Local data flow
3725
Using local data flow
3826
~~~~~~~~~~~~~~~~~~~~~
3927

40-
The local data flow library is in the module ``DataFlow``, which defines the class ``Node`` denoting any element that data can flow through. ``Node``\ s are divided into expression nodes (``ExprNode``) and parameter nodes (``ParameterNode``). You can map between data flow nodes and expressions/parameters using the member predicates ``asExpr`` and ``asParameter``:
28+
To use the data flow library you need the following import:
29+
30+
.. code-block:: ql
31+
32+
import semmle.code.java.dataflow.DataFlow
33+
34+
The ``DataFlow`` module defines the class ``Node`` denoting any element that data can flow through. ``Node``\ s are divided into expression nodes (``ExprNode``) and parameter nodes (``ParameterNode``). You can map between data flow nodes and expressions/parameters using the member predicates ``asExpr`` and ``asParameter``:
4135

4236
.. code-block:: ql
4337
@@ -85,7 +79,14 @@ Local taint tracking extends local data flow by including non-value-preserving f
8579
8680
If ``x`` is a tainted string then ``y`` is also tainted.
8781

88-
The local taint tracking library is in the module ``TaintTracking``. Like local data flow, a predicate ``localTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo)`` holds if there is an immediate taint propagation edge from the node ``nodeFrom`` to the node ``nodeTo``. You can apply the predicate recursively by using the ``+`` and ``*`` operators, or by using the predefined recursive predicate ``localTaint``, which is equivalent to ``localTaintStep*``.
82+
83+
To use the taint tracking library you need the following import:
84+
85+
.. code-block:: ql
86+
87+
import semmle.code.java.dataflow.TaintTracking
88+
89+
Like local data flow, a predicate ``localTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo)`` holds if there is an immediate taint propagation edge from the node ``nodeFrom`` to the node ``nodeTo``. You can apply the predicate recursively by using the ``+`` and ``*`` operators, or by using the predefined recursive predicate ``localTaint``, which is equivalent to ``localTaintStep*``.
8990

9091
For example, you can find taint propagation from a parameter ``source`` to an expression ``sink`` in zero or more local steps:
9192

0 commit comments

Comments
 (0)