Skip to content

Commit a4f3e5e

Browse files
felicitymaysubatoirobertbrignull
committed
Apply suggestions from code review
Co-authored-by: Ben Ahmady <[email protected]> Co-authored-by: Robert <[email protected]>
1 parent 93eff2a commit a4f3e5e

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

docs/codeql/codeql-for-visual-studio-code/using-the-codeql-model-editor.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ You can view, write, and edit all types of CodeQL packs in Visual Studio Code us
1212
About the CodeQL model editor
1313
-----------------------------
1414

15-
The CodeQL model editor guides you through modeling the calls to external dependencies in your application or fully modeling all the public entry and exit points in an external dependency
15+
The CodeQL model editor guides you through modeling the calls to external dependencies in your application or fully modeling all the public entry and exit points in an external dependency.
1616

1717
When you open the model editor, it analyzes the currently selected CodeQL database and identifies where the application uses external APIs and all public methods. An external (or third party) API is any API that is not part of the CodeQL database you have selected.
1818

1919
The model editor has two different modes:
2020

21-
- Application mode (default view): The editor lists each external framework used by the seelcted CodeQL database. When you expand a framework, a list of all calls to and from the external API is shown with the options available to model dataflow through each call. This mode is most useful for improving the CodeQL results for the specific codebase.
21+
- Application mode (default view): The editor lists each external framework used by the selected CodeQL database. When you expand a framework, a list of all calls to and from the external API is shown with the options available to model dataflow through each call. This mode is most useful for improving the CodeQL results for the specific codebase.
2222

23-
- Dependency mode: The editor identifies the all publicly accessible APIs in the selected CodeQL database. This view guides you through modeling each public API that the codebase makes available. When you have finished modeling the entire API, you can save the model and use it to improve the CodeQL analysis for all codebases that use the dependency.
23+
- Dependency mode: The editor identifies all of the publicly accessible APIs in the selected CodeQL database. This view guides you through modeling each public API that the codebase makes available. When you have finished modeling the entire API, you can save the model and use it to improve the CodeQL analysis for all codebases that use the dependency.
2424

2525
Displaying the CodeQL model editor
2626
----------------------------------
@@ -38,7 +38,7 @@ Modeling the calls your codebase makes to external APIs
3838
You typically use this method when you are looking at a specific codebase where you want to improve the precision of CodeQL results. This is usually when the codebase uses frameworks or libraries that are not supported by CodeQL but they are not used by other teams in your organization.
3939

4040
#. Select the CodeQL database that you want to improve CodeQL coverage for.
41-
#. Display the CodeQL model editor, by default the editor runs in application mode, so the list of external APIs used by the selected codebase is shown.
41+
#. Display the CodeQL model editor. By default the editor runs in application mode, so the list of external APIs used by the selected codebase is shown.
4242

4343
.. image:: ../images/codeql-for-visual-studio-code/model-application-mode.png
4444
:width: 800
@@ -58,10 +58,10 @@ You typically use this method when you are looking at a specific codebase where
5858
- **Sink**: choose the **Input** element to model.
5959
- **Flow summary**: choose the **Input** and **Output** elements to model.
6060

61-
#. Define the **Kind** of data flow for the model.
61+
#. Define the **Kind** of dataflow for the model.
6262
#. When you have finished modeling, click **Save all** or **Save** (shown at the bottom right of each expanded list of calls). The percentage of calls modeled in the editor is updated.
6363

64-
The models are stored in your workspace at ``.github/codeql/extensions/<codeql-model-pack>``, where ``<codeql-model-packe>`` is the name of the CodeQL database that you selected. That is, the name of the repository, hyphen, the language analyzed by CodeQL.
64+
The models are stored in your workspace at ``.github/codeql/extensions/<codeql-model-pack>``, where ``<codeql-model-pack>`` is the name of the CodeQL database that you selected. That is, the name of the repository, hyphen, the language analyzed by CodeQL.
6565

6666
The models are stored in a series of YAML data extension files, one for each external API. For example:
6767

@@ -76,7 +76,7 @@ Modeling the public API of a codebase
7676
You typically use this method when you want to model a framework or library that your organization uses in more than one codebase. Once you have finished creating and testing the model, you can publish the CodeQL model pack to the GitHub Container Registry for your whole organization to use.
7777

7878
#. Select the CodeQL database that you want to model.
79-
#. Display the CodeQL model editor, by default the editor runs in application mode. Click **Model as dependency** to display dependency mode. The screen changes to show the public API of the framework or library.
79+
#. Display the CodeQL model editor. By default the editor runs in application mode. Click **Model as dependency** to display dependency mode. The screen changes to show the public API of the framework or library.
8080

8181
.. image:: ../images/codeql-for-visual-studio-code/model-dependency-mode.png
8282
:width: 800
@@ -96,10 +96,10 @@ You typically use this method when you want to model a framework or library that
9696
- **Sink**: choose the **Input** element to model.
9797
- **Flow summary**: choose the **Input** and **Output** elements to model.
9898

99-
#. Define the **Kind** of data flow for the model.
99+
#. Define the **Kind** of dataflow for the model.
100100
#. When you have finished modeling, click **Save all** or **Save** (shown at the bottom right of each expanded list of calls). The percentage of calls modeled in the editor is updated.
101101

102-
The models are stored in your workspace at ``.github/codeql/extensions/<codeql-model-pack>``, where ``<codeql-model-packe>`` is the name of the CodeQL database that you selected. That is, the name of the repository, hyphen, the language analyzed by CodeQL.
102+
The models are stored in your workspace at ``.github/codeql/extensions/<codeql-model-pack>``, where ``<codeql-model-pack>`` is the name of the CodeQL database that you selected. That is, the name of the repository, hyphen, the language analyzed by CodeQL.
103103

104104
The models are stored in a series of YAML data extension files, one for each public method. For example:
105105

docs/codeql/codeql-language-guides/data-extensions-to-model-java-dependencies.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ For more information, see ":ref:`Using the CodeQL model editor <using-the-codeql
2121
About data extensions
2222
---------------------
2323

24-
You can customize analysis by defining models (summaries, sinks, and sources) of your code's dependencies in data extension files. Each model defines the behavior of one or more elements of your library or framework, such as a methods and callables. When you run data flow analysis, these models expand the potential sources and sinks tracked by data flow analysis and improve the precision of results.
24+
You can customize analysis by defining models (summaries, sinks, and sources) of your code's dependencies in data extension files. Each model defines the behavior of one or more elements of your library or framework, such as a methods and callables. When you run dataflow analysis, these models expand the potential sources and sinks tracked by data flow analysis and improve the precision of results.
2525

26-
Most of the security queries search for paths from a source of untrusted input to a sink that represents a vulnerability, this is known as taint tracking. Each source is a starting point for data flow analysis to track tainted data and each sink is an end point.
26+
Most of the security queries search for paths from a source of untrusted input to a sink that represents a vulnerability. This is known as taint tracking. Each source is a starting point for dataflow analysis to track tainted data and each sink is an end point.
2727

2828
Taint tracking queries also need to know how data can flow through elements that are not included in the source code. These are modeled as summaries. A summary model enables queries to synthesize the flow behavior through elements in dependency code that is not stored in your repository.
2929

@@ -63,7 +63,7 @@ The CodeQL library for Java and Kotlin analysis exposes the following extensible
6363

6464
- ``sourceModel(package, type, subtypes, name, signature, ext, output, kind, provenance)``. This is used to model sources of potentially tainted data.
6565
- ``sinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance)``. This is used to model sinks where tainted data maybe used in a way that makes the code vulnerable.
66-
- ``summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance)``. This is used to summarize how data values from a source flow outside the repository in a dependency of the main code base.
66+
- ``summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance)``. This is used to summarize how data values from a source flow outside the repository in a dependency of the main codebase.
6767
- ``neutralModel(package, type, name, signature, kind, provenance)``. This is similar to a summary model but used to model the flow of values that have only a minor impact on the data flow analysis.
6868

6969
The extensible predicates are populated using data extensions specified in YAML files. For more information about extensible predicates, see ":doc:`extensible-predicates`."

docs/codeql/codeql-language-guides/extensible-predicates.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Extensible predicates and their interaction with data extensions
77
================================================================
88

9-
You can use data extensions to model the methods and callables that control data flow in any framework or library. This is especially useful for custom frameworks or niche libraries, that are not supported by the standard CodeQL libraries.
9+
You can use data extensions to model the methods and callables that control dataflow in any framework or library. This is especially useful for custom frameworks or niche libraries, that are not supported by the standard CodeQL libraries.
1010

1111
.. include:: ../reusables/beta-note-model-packs-java.rst
1212

@@ -20,7 +20,7 @@ Sources, sinks, summaries, and neutrals are commonly known as models. These mode
2020
About extensible predicates
2121
---------------------------
2222

23-
At a high level, there are two main components to using data extensions. The query writer defines one or more extensible predicates in their query libraries. CLI and code scanning users who want to augment these predicates supply one or more extension files whose data gets injected into the extensible predicate during evaluation. The extension files are either stored directly in the repository where the code base to be analyzed is hosted, or downloaded as CodeQL model packs.
23+
At a high level, there are two main components to using data extensions. The query writer defines one or more extensible predicates in their query libraries. CLI and code scanning users who want to augment these predicates supply one or more extension files whose data gets injected into the extensible predicate during evaluation. The extension files are either stored directly in the repository where the codebase to be analyzed is hosted, or downloaded as CodeQL model packs.
2424

2525
This example of an extensible predicate for a source is taken from the core Java libraries https://github.com/github/codeql/blob/main/java/ql/lib/semmle/code/java/dataflow/ExternalFlowExtensions.qll#L8-L11
2626

@@ -99,7 +99,7 @@ The following sink kinds are supported:
9999
- ``request-forgery``: A sink that controls the URL of a request, such as in an ``HttpRequest.newBuilder`` call.
100100
- ``response-splitting``: A sink that can be used for HTTP response splitting, such as in calls to ``HttpServletResponse.setHeader``.
101101
- ``sql-injection``: A sink that can be used for SQL injection, such as in a ``Statement.executeQuery`` call.
102-
- ``template-injection``: A sink that can be used for server side template injection, such as in a ``Velocity.evaluate`` call.
102+
- ``template-injection``: A sink that can be used for server-side template injection, such as in a ``Velocity.evaluate`` call.
103103
- ``trust-boundary-violation``: A sink that can be used to cross a trust boundary, such as in a ``HttpSession.setAttribute`` call.
104104
- ``url-redirection``: A sink that can be used to redirect the user to a malicious URL, such as in a ``Response.temporaryRedirect`` call.
105105
- ``xpath-injection``: A sink that can be used for XPath injection, such as in a ``XPath.evaluate`` call.
@@ -123,8 +123,8 @@ neutralModel(package, type, name, signature, kind, provenance)
123123
--------------------------------------------------------------
124124

125125
This extensible predicate is not typically needed externally, but is included here for completeness.
126-
It has limited impact on data flow analysis.
127-
Manual neutrals are considered high confidence dispatch call targets and can reduce the number of dispatch call targets during data flow analysis (a performance optimization).
126+
It has limited impact on dataflow analysis.
127+
Manual neutrals are considered high-confidence dispatch call targets and can reduce the number of dispatch call targets during data flow analysis (a performance optimization).
128128

129129
- ``kind``: Kind of the neutral. For neutrals the kind can be ``summary``, ``source``, or ``sink`` to indicate that the callable is neutral with respect to flow (no summary), source (is not a source) or sink (is not a sink).
130130

@@ -175,7 +175,7 @@ and verification is one of:
175175
- ``generated``: The model was generated, but not verified by a human.
176176

177177
The provenance is used to distinguish between models that are manually added (or verified) to the extensible predicate and models that are automatically generated.
178-
Furthermore, it impacts the data flow analysis in the following way:
178+
Furthermore, it impacts the dataflow analysis in the following way:
179179

180180
- A ``manual`` model takes precedence over ``generated`` models. If a ``manual`` model exists for an element then all ``generated`` models are ignored.
181181
- A ``generated`` model is ignored during analysis, if the source code of the element it is modeling is available.

0 commit comments

Comments
 (0)