Skip to content

Commit 24e5519

Browse files
RasmusWLjames
authored andcommitted
docs: Fix Python taint tracking links
at some point we moved security/TaintTracking.qll to dataflow/TaintTracking.qll (cherry picked from commit f44ce7d)
1 parent 97d3d1f commit 24e5519

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

docs/language/learn-ql/python/introduce-libraries-python.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ The CodeQL library for Python also supplies classes to specify taint-tracking an
323323
Summary
324324
~~~~~~~
325325

326-
- `TaintKind <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintKind.html>`__
327-
- `Configuration <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintTracking$Configuration.html>`__
326+
- `TaintKind <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/type.TaintTracking$TaintKind.html>`__
327+
- `Configuration <https://help.semmle.com/qldoc/python/semmle/python/dataflow/Configuration.qll/type.Configuration$TaintTracking$Configuration.html>`__
328328

329329
These classes are explained in more detail in :doc:`Tutorial: Taint tracking and data flow analysis in Python <taint-tracking>`.
330330

docs/language/learn-ql/python/taint-tracking.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Taint tracking and data flow analysis in Python
44
Overview
55
--------
66

7-
Taint tracking is used to analyze how potentially insecure, or 'tainted' data flows throughout a program at runtime.
7+
Taint tracking is used to analyze how potentially insecure, or 'tainted' data flows throughout a program at runtime.
88
You can use taint tracking to find out whether user-controlled input can be used in a malicious way,
99
whether dangerous arguments are passed to vulnerable functions, and whether confidential or sensitive data can leak.
1010
You can also use it to track invalid, insecure, or untrusted data in other analyses.
@@ -13,36 +13,36 @@ Taint tracking differs from basic data flow in that it considers non-value-prese
1313
For example, in the assignment ``dir = path + "/"``, if ``path`` is tainted then ``dir`` is also tainted,
1414
even though there is no data flow from ``path`` to ``path + "/"``.
1515

16-
Separate CodeQL libraries have been written to handle 'normal' data flow and taint tracking in :doc:`C/C++ <../cpp/dataflow>`, :doc:`C# <../csharp/dataflow>`, :doc:`Java <../java/dataflow>`, and :doc:`JavaScript <../javascript/dataflow>`. You can access the appropriate classes and predicates that reason about these different modes of data flow by importing the appropriate library in your query.
17-
In Python analysis, we can use the same taint tracking library to model both 'normal' data flow and taint flow, but we are still able make the distinction between steps that preserve value and those that don't by defining additional data flow properties.
16+
Separate CodeQL libraries have been written to handle 'normal' data flow and taint tracking in :doc:`C/C++ <../cpp/dataflow>`, :doc:`C# <../csharp/dataflow>`, :doc:`Java <../java/dataflow>`, and :doc:`JavaScript <../javascript/dataflow>`. You can access the appropriate classes and predicates that reason about these different modes of data flow by importing the appropriate library in your query.
17+
In Python analysis, we can use the same taint tracking library to model both 'normal' data flow and taint flow, but we are still able make the distinction between steps that preserve value and those that don't by defining additional data flow properties.
1818

1919
For further information on data flow and taint tracking with CodeQL, see :doc:`Introduction to data flow <../intro-to-data-flow>`.
2020

2121
Fundamentals of taint tracking and data flow analysis
2222
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2323

24-
The taint tracking library is in the `TaintTracking <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/module.TaintTracking.html>`__ module.
24+
The taint tracking library is in the `TaintTracking <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/module.TaintTracking.html>`__ module.
2525
Any taint tracking or data flow analysis query has three explicit components, one of which is optional, and an implicit component.
2626
The explicit components are:
2727

28-
1. One or more ``sources`` of potentially insecure or unsafe data, represented by the `TaintTracking::Source <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintSource.html>`__ class.
29-
2. One or more ``sinks``, to where the data or taint may flow, represented by the `TaintTracking::Sink <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintSink.html>`__ class.
30-
3. Zero or more ``sanitizers``, represented by the `Sanitizer <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$Sanitizer.html>`__ class.
28+
1. One or more ``sources`` of potentially insecure or unsafe data, represented by the `TaintTracking::Source <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/type.TaintTracking$TaintSource.html>`__ class.
29+
2. One or more ``sinks``, to where the data or taint may flow, represented by the `TaintTracking::Sink <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/type.TaintTracking$TaintSink.html>`__ class.
30+
3. Zero or more ``sanitizers``, represented by the `Sanitizer <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/type.TaintTracking$Sanitizer.html>`__ class.
3131

3232
A taint tracking or data flow query gives results when there is the flow of data from a source to a sink, which is not blocked by a sanitizer.
3333

34-
These three components are bound together using a `TaintTracking::Configuration <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintTracking$Configuration.html>`__.
34+
These three components are bound together using a `TaintTracking::Configuration <https://help.semmle.com/qldoc/python/semmle/python/dataflow/Configuration.qll/type.Configuration$TaintTracking$Configuration.html>`__.
3535
The purpose of the configuration is to specify exactly which sources and sinks are relevant to the specific query.
3636

37-
The final, implicit component is the "kind" of taint, represented by the `TaintKind <https://help.semmle.com/qldoc/python/semmle/python/security/TaintTracking.qll/type.TaintTracking$TaintKind.html>`__ class.
37+
The final, implicit component is the "kind" of taint, represented by the `TaintKind <https://help.semmle.com/qldoc/python/semmle/python/dataflow/TaintTracking.qll/type.TaintTracking$TaintKind.html>`__ class.
3838
The kind of taint determines which non-value-preserving steps are possible, in addition to value-preserving steps that are built into the analysis.
39-
In the above example ``dir = path + "/"``, taint flows from ``path`` to ``dir`` if the taint represents a string, but not if the taint is ``None``.
39+
In the above example ``dir = path + "/"``, taint flows from ``path`` to ``dir`` if the taint represents a string, but not if the taint is ``None``.
4040

4141
Limitations
4242
~~~~~~~~~~~
4343

4444
Although taint tracking is a powerful technique, it is worth noting that it depends on the underlying data flow graphs.
45-
Creating a data flow graph that is both accurate and covers a large enough part of a program is a challenge,
45+
Creating a data flow graph that is both accurate and covers a large enough part of a program is a challenge,
4646
especially for a dynamic language like Python. The call graph might be incomplete, the reachability of code is an approximation,
4747
and certain constructs, like ``eval``, are just too dynamic to analyze.
4848

@@ -61,18 +61,18 @@ A simple taint tracking query has the basic form:
6161
*/
6262
6363
import semmle.python.security.TaintTracking
64-
64+
6565
class MyConfiguration extends TaintTracking::Configuration {
66-
66+
6767
MyConfiguration() { this = "My example configuration" }
68-
68+
6969
override predicate isSource(TaintTracking::Source src) { ... }
70-
70+
7171
override predicate isSink(TaintTracking::Sink sink) { ... }
72-
72+
7373
/* optionally */
7474
override predicate isExtension(Extension extension) { ... }
75-
75+
7676
}
7777
7878
from MyConfiguration config, TaintTracking::Source src, TaintTracking::Sink sink
@@ -107,17 +107,17 @@ The sink is defined by using a custom ``TaintTracking::Sink`` class.
107107
}
108108
109109
}
110-
110+
111111
class HttpToUnsafeConfiguration extends TaintTracking::Configuration {
112-
113-
HttpToUnsafeConfiguration() {
112+
113+
HttpToUnsafeConfiguration() {
114114
this = "Example config finding flow from http request to 'unsafe' function"
115115
}
116-
116+
117117
override predicate isSource(TaintTracking::Source src) { src instanceof HttpRequestTaintSource }
118-
118+
119119
override predicate isSink(TaintTracking::Sink sink) { sink instanceof UnsafeSink }
120-
120+
121121
}
122122
123123
from HttpToUnsafeConfiguration config, TaintTracking::Source src, TaintTracking::Sink sink
@@ -183,17 +183,17 @@ Thus, our example query becomes:
183183
}
184184
185185
}
186-
186+
187187
class HttpToUnsafeConfiguration extends TaintTracking::Configuration {
188-
189-
HttpToUnsafeConfiguration() {
188+
189+
HttpToUnsafeConfiguration() {
190190
this = "Example config finding flow from http request to 'unsafe' function"
191191
}
192-
192+
193193
override predicate isSource(TaintTracking::Source src) { src instanceof HttpRequestTaintSource }
194-
194+
195195
override predicate isSink(TaintTracking::Sink sink) { sink instanceof UnsafeSink }
196-
196+
197197
}
198198
199199
from HttpToUnsafeConfiguration config, TaintedPathSource src, TaintedPathSink sink
@@ -205,7 +205,7 @@ Thus, our example query becomes:
205205
Custom taint kinds and flows
206206
----------------------------
207207

208-
In the above examples, we have assumed the existence of a suitable ``TaintKind``,
208+
In the above examples, we have assumed the existence of a suitable ``TaintKind``,
209209
but sometimes it is necessary to model the flow of other objects, such as database connections, or ``None``.
210210

211211
The ``TaintTracking::Source`` and ``TaintTracking::Sink`` classes have predicates that determine which kind of taint the source and sink model, respectively.

0 commit comments

Comments
 (0)