Skip to content

Commit 5ddcf92

Browse files
committed
Editorial changes to library modeling topic
1 parent d8ff2d1 commit 5ddcf92

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

docs/language/learn-ql/go/library-modeling-go.rst

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Modeling data flow in Go libraries
22
==================================
33

44
When analyzing a Go program, CodeQL does not examine the source code for
5-
external packages. To track the flow of untrusted data through a library you
5+
external packages. To track the flow of untrusted data through a library, you
66
can create a model of the library.
77

88
You can find existing models in the ``ql/src/semmle/go/frameworks/`` folder of the
@@ -20,9 +20,9 @@ example from ``Mux.qll``.
2020

2121
.. code-block:: ql
2222
23-
class RequestVars extends DataFlow::UntrustedFlowSource::Range, DataFlow::CallNode {
24-
RequestVars() { this.getTarget().hasQualifiedName("github.com/gorilla/mux", "Vars") }
25-
}
23+
class RequestVars extends DataFlow::UntrustedFlowSource::Range, DataFlow::CallNode {
24+
RequestVars() { this.getTarget().hasQualifiedName("github.com/gorilla/mux", "Vars") }
25+
}
2626
2727
This has the effect that all calls to `the function Vars from the
2828
package mux <http://www.gorillatoolkit.org/pkg/mux#Vars>`__ are
@@ -68,7 +68,7 @@ outputs to a function. The options are:
6868
* one of the parameters (``outp.isParameter(i)``)
6969
* one of the results (``outp.isResult(i)``, or ``outp.isResult`` if there is only one result)
7070

71-
Here is an example from ``Gin.qll``, slightly modified for brevity.
71+
Here is an example from ``Gin.qll``, which has been slightly simplified.
7272

7373
.. code-block:: ql
7474
@@ -89,8 +89,8 @@ the receiver to the first result. In other words, if ``p`` has type
8989
Sanitizers
9090
----------
9191

92-
It is not necessary to indicate that library functions are sanitizers -
93-
because their bodies are not analyzed it is assumed that data does not
92+
It is not necessary to indicate that library functions are sanitizers.
93+
Their bodies are not analyzed, so it is assumed that data does not
9494
flow through them.
9595

9696
Sinks
@@ -101,13 +101,12 @@ However, you can use library models to indicate when functions belong to
101101
special categories. Queries can then use these categories when specifying
102102
sinks. Classes representing these special categories are contained in
103103
``ql/src/semmle/go/Concepts.qll`` in the `CodeQL for Go repository
104-
<https://github.com/github/codeql-go/blob/main/ql/src/semmle/go/Concepts.qll>`__,
105-
including classes for logger mechanisms,
104+
<https://github.com/github/codeql-go/blob/main/ql/src/semmle/go/Concepts.qll>`__.
105+
``Concepts.qll`` includes classes for logger mechanisms,
106106
HTTP response writers, HTTP redirects, and marshaling and unmarshaling
107107
functions.
108108

109-
Here is a short example from ``Stdlib.qll``, slightly modified for
110-
brevity.
109+
Here is a short example from ``Stdlib.qll``, which has been slightly simplified.
111110

112111
.. code-block:: ql
113112
@@ -120,4 +119,4 @@ brevity.
120119
This has the effect that any call to ``Print``, ``Printf``, or
121120
``Println`` in the package ``fmt`` is recognized as a logger call.
122121
Any query that uses logger calls as a sink will then identify when tainted data
123-
has been passed as an argument to ``Print``, ``Printf``, or ``Println``.
122+
has been passed as an argument to ``Print``, ``Printf``, or ``Println``.

0 commit comments

Comments
 (0)