You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/codeql/codeql-language-guides/analyzing-data-flow-in-cpp.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,7 @@ Global data flow tracks data flow throughout the entire program, and is therefor
172
172
Using global data flow
173
173
~~~~~~~~~~~~~~~~~~~~~~
174
174
175
-
The global data flow library is used by implementing the signature ``DataFlow::ConfigSig`` and applying the module ``DataFlow::Global<ConfigSig>`` as follows:
175
+
We can use the global data flow library by implementing the signature ``DataFlow::ConfigSig`` and applying the module ``DataFlow::Global<ConfigSig>``:
176
176
177
177
.. code-block:: ql
178
178
@@ -314,7 +314,7 @@ Exercise 2: Write a query that finds all hard-coded strings used to create a ``h
314
314
315
315
Exercise 3: Write a class that represents flow sources from ``getenv``. (`Answer <#exercise-3>`__)
316
316
317
-
Exercise 4: Using the answers from 2 and 3, write a query which finds all global data flows from ``getenv`` to ``gethostbyname``. (`Answer <#exercise-4>`__)
317
+
Exercise 4: Using the answers from 2 and 3, write a query which finds all global data flow paths from ``getenv`` to ``gethostbyname``. (`Answer <#exercise-4>`__)
Copy file name to clipboardExpand all lines: docs/codeql/codeql-language-guides/analyzing-data-flow-in-csharp.rst
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,8 +65,7 @@ Local taint tracking extends local data flow by including non-value-preserving f
65
65
66
66
.. code-block:: csharp
67
67
68
-
vartemp=x;
69
-
vary=temp+", "+temp;
68
+
vary="Hello "+x;
70
69
71
70
If ``x`` is a tainted string then ``y`` is also tainted.
72
71
@@ -104,7 +103,7 @@ Unfortunately this will only give the expression in the argument, not the values
104
103
and DataFlow::localFlow(DataFlow::exprNode(src), DataFlow::exprNode(call.getArgument(0)))
105
104
select src
106
105
107
-
Then we can make the source more specific, for example an access to a public parameter. This query finds instances where a public parameter is used to open a file:
106
+
To restrict sources to only an access to a public parameter, rather than arbitrary expressions, we can modify this query as follows:
108
107
109
108
.. code-block:: ql
110
109
@@ -117,7 +116,7 @@ Then we can make the source more specific, for example an access to a public par
117
116
and call.getEnclosingCallable().(Member).isPublic()
118
117
select p, "Opening a file from a public method."
119
118
120
-
This query finds calls to ``String.Format`` where the format string isn't hard-coded:
119
+
The following query finds calls to ``String.Format`` where the format string isn't hard-coded:
121
120
122
121
.. code-block:: ql
123
122
@@ -148,7 +147,7 @@ Global data flow tracks data flow throughout the entire program, and is therefor
148
147
Using global data flow
149
148
~~~~~~~~~~~~~~~~~~~~~~
150
149
151
-
The global data flow library is used by implementing the signature ``DataFlow::ConfigSig`` and applying the module ``DataFlow::Global<ConfigSig>``:
150
+
We can use the global data flow library by implementing the signature ``DataFlow::ConfigSig`` and applying the module ``DataFlow::Global<ConfigSig>``:
152
151
153
152
.. code-block:: ql
154
153
@@ -170,8 +169,8 @@ These predicates are defined in the configuration:
170
169
171
170
- ``isSource`` - defines where data may flow from.
172
171
- ``isSink`` - defines where data may flow to.
173
-
- ``isBarrier`` - optionally, restricts the data flow.
The data flow analysis is performed using the predicate ``flow(DataFlow::Node source, DataFlow::Node sink)``:
177
176
@@ -288,7 +287,7 @@ Exercise 2: Find all hard-coded strings passed to ``System.Uri``, using global d
288
287
289
288
Exercise 3: Define a class that represents flow sources from ``System.Environment.GetEnvironmentVariable``. (`Answer <#exercise-3>`__)
290
289
291
-
Exercise 4: Using the answers from 2 and 3, write a query to find all global data flow from ``System.Environment.GetEnvironmentVariable`` to ``System.Uri``. (`Answer <#exercise-4>`__)
290
+
Exercise 4: Using the answers from 2 and 3, write a query which finds all global data flow paths from ``System.Environment.GetEnvironmentVariable`` to ``System.Uri``. (`Answer <#exercise-4>`__)
0 commit comments