Skip to content

Commit 8661de1

Browse files
author
james
committed
docs: update ql terminology
1 parent 1fe5a9e commit 8661de1

17 files changed

+115
-148
lines changed
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
QL training and variant analysis examples
2-
#########################################
1+
CodeQL training and variant analysis examples
2+
=============================================
33

44
QL and variant analysis
5-
=======================
5+
-----------------------
66

77
`Variant analysis <https://semmle.com/variant-analysis>`__ is the process of using a known vulnerability as a seed to find similar problems in your code. Security engineers typically perform variant analysis to identify possible vulnerabilities and to ensure that these threats are properly fixed across multiple code bases.
88

9-
`QL <https://semmle.com/ql>`__ is Semmle's variant analysis engine, and it is also the technology that underpins LGTM, Semmle's community driven security analysis platform. Together, QL and LGTM provide continuous monitoring and scalable variant analysis for your projects, even if you don’t have your own team of dedicated security engineers. You can read more about using QL and LGTM in variant analysis in the `Semmle blog <https://blog.semmle.com/tags/variant-analysis>`__.
9+
`CodeQL <https://semmle.com/ql>`__ is the code analysis engine that underpins LGTM, Semmle's community driven security analysis platform. Together, CodeQL and LGTM provide continuous monitoring and scalable variant analysis for your projects, even if you don’t have your own team of dedicated security engineers. You can read more about using CodeQL and LGTM in variant analysis in the `Semmle blog <https://blog.semmle.com/tags/variant-analysis>`__.
1010

11-
The QL language is easy to learn, and exploring code using QL is the most efficient way to perform variant analysis.
11+
CodeQL is easy to learn, and exploring code using CodeQL is the most efficient way to perform variant analysis.
1212

1313
Learning QL for variant analysis
14-
================================
14+
--------------------------------
1515

16-
Start learning how to use QL in variant analysis for a specific language by looking at the topics below. Each topic links to a short presentation on the QL language, QL libraries, or an example variant discovered using QL.
16+
Start learning how to use CodeQL in variant analysis for a specific language by looking at the topics below. Each topic links to a short presentation on CodeQL, its libraries, or an example variant discovered using CodeQL.
1717

1818
.. |arrow-l| unicode:: U+2190
1919

@@ -24,43 +24,43 @@ Start learning how to use QL in variant analysis for a specific language by look
2424
When you have selected a presentation, use |arrow-r| and |arrow-l| to navigate between slides.
2525
Press **p** to view the additional notes on slides that have an information icon |info| in the top right corner, and press **f** to enter full-screen mode.
2626

27-
The presentations contain a number of QL query examples.
27+
The presentations contain a number of query examples.
2828
We recommend that you download `QL for Eclipse <https://help.semmle.com/ql-for-eclipse/Content/WebHelp/home-page.html>`__ and import the example snapshot for each presentation so that you can find the bugs mentioned in the slides.
2929

3030

3131
.. pull-quote::
3232

3333
Information
3434

35-
The presentations listed below are used in QL language and variant analysis training sessions run by Semmle engineers.
35+
The presentations listed below are used in CodeQL and variant analysis training sessions run by Semmle engineers.
3636
Therefore, be aware that the slides are designed to be presented by an instructor.
3737
If you are using the slides without an instructor, please use the additional notes to help guide you through the examples.
3838

39-
QL and variant analysis for C/C++
40-
---------------------------------
39+
CodeQL and variant analysis for C/C++
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4141

42-
- `Introduction to variant analysis: QL for C/C++ <../ql-training/cpp/intro-ql-cpp.html>`__–an introduction to variant analysis and QL for C/C++ programmers.
42+
- `Introduction to variant analysis: CodeQL for C/C++ <../ql-training/cpp/intro-ql-cpp.html>`__–an introduction to variant analysis and CodeQL for C/C++ programmers.
4343
- `Example: Bad overflow guard <../ql-training/cpp/bad-overflow-guard.html>`__–an example of iterative query development to find bad overflow guards in a C++ project.
44-
- `Program representation: QL for C/C++ <../ql-training/cpp/program-representation-cpp.html>`__–information on how QL analysis represents C/C++ programs.
45-
- `Introduction to local data flow <../ql-training/cpp/data-flow-cpp.html>`__–an introduction to analyzing local data flow in C/C++ using QL, including an example demonstrating how to develop a query to find a real CVE.
44+
- `Program representation: CodeQL for C/C++ <../ql-training/cpp/program-representation-cpp.html>`__–information on how CodeQL analysis represents C/C++ programs.
45+
- `Introduction to local data flow <../ql-training/cpp/data-flow-cpp.html>`__–an introduction to analyzing local data flow in C/C++ using CodeQL, including an example demonstrating how to develop a query to find a real CVE.
4646
- `Exercise: snprintf overflow <../ql-training/cpp/snprintf.html>`__–an example demonstrating how to develop a data flow query.
47-
- `Introduction to global data flow <../ql-training/cpp/global-data-flow-cpp.html>`__–an introduction to analyzing global data flow in C/C++ using QL.
48-
- `Analyzing control flow: QL for C/C++ <../ql-training/cpp/control-flow-cpp.html>`__–an introduction to analyzing control flow in C/C++ using QL.
47+
- `Introduction to global data flow <../ql-training/cpp/global-data-flow-cpp.html>`__–an introduction to analyzing global data flow in C/C++ using CodeQL.
48+
- `Analyzing control flow: CodeQL for C/C++ <../ql-training/cpp/control-flow-cpp.html>`__–an introduction to analyzing control flow in C/C++ using QL.
4949

50-
QL and variant analysis for Java
51-
--------------------------------
50+
CodeQL and variant analysis for Java
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5252

53-
- `Introduction to variant analysis: QL for Java <../ql-training/java/intro-ql-java.html>`__–an introduction to variant analysis and QL for Java programmers.
53+
- `Introduction to variant analysis: CodeQL for Java <../ql-training/java/intro-ql-java.html>`__–an introduction to variant analysis and CodeQL for Java programmers.
5454
- `Example: Query injection <../ql-training/java/query-injection-java.html>`__–an example of iterative query development to find unsanitized SPARQL injections in a Java project.
55-
- `Program representation: QL for Java <../ql-training/java/program-representation-java.html>`__–information on how QL analysis represents Java programs.
56-
- `Introduction to local data flow <../ql-training/java/data-flow-java.html>`__–an introduction to analyzing local data flow in Java using QL, including an example demonstrating how to develop a query to find a real CVE.
55+
- `Program representation: CodeQL for Java <../ql-training/java/program-representation-java.html>`__–information on how CodeQL analysis represents Java programs.
56+
- `Introduction to local data flow <../ql-training/java/data-flow-java.html>`__–an introduction to analyzing local data flow in Java using CodeQL, including an example demonstrating how to develop a query to find a real CVE.
5757
- `Exercise: Apache Struts <../ql-training/java/apache-struts-java.html>`__–an example demonstrating how to develop a data flow query.
58-
- `Introduction to global data flow <../ql-training/java/global-data-flow-java.html>`__–an introduction to analyzing global data flow in Java using QL.
58+
- `Introduction to global data flow <../ql-training/java/global-data-flow-java.html>`__–an introduction to analyzing global data flow in Java using CodeQL.
5959

6060
More resources
61-
--------------
61+
~~~~~~~~~~~~~~
6262

63-
- If you are completely new to QL, look at our introductory topics in :ref:`Getting started <getting-started>`.
64-
- To find more detailed information about how to write QL queries for specific languages, visit the links in :ref:`Writing QL queries <writing-ql-queries>`.
65-
- To read more about how QL queries have been used in Semmle's security research, and to read about new QL developments, visit the `Semmle blog <https://blog.semmle.com>`__.
63+
- If you are completely new to CodeQL, look at our introductory topics in :doc:`Learning CodeQL <index>`.
64+
- To find more detailed information about how to write CodeQL queries for specific languages, visit the links in :ref:`Writing CodeQL queries <writing-ql-queries>`.
65+
- To read more about how CodeQL queries have been used in Semmle's security research, and to read about new CodeQL developments, visit the `Semmle blog <https://blog.semmle.com>`__.
6666
- Find more examples of queries written by Semmle's own security researchers in the `Semmle Demos repository <https://github.com/semmle/demos>`__ on GitHub.

docs/language/ql-training/cpp/bad-overflow-guard.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Example: Bad overflow guard
33
===========================
44

5-
QL for C/C++
5+
CodeQL for C/C++
66

77
.. container:: semmle-logo
88

@@ -127,13 +127,13 @@ This happens even though the overflow check passed!
127127

128128
.. rst-class:: background2
129129

130-
Developing a QL query
131-
=====================
130+
Developing a CodeQL query
131+
=========================
132132

133133
Finding bad overflow guards
134134

135-
QL query: bad overflow guards
136-
=============================
135+
CodeQL query: bad overflow guards
136+
==================================
137137

138138
Let’s look for overflow guards of the form ``v + b < v``, using the classes
139139
``AddExpr``, ``Variable`` and ``RelationalOperation`` from the ``cpp`` library.
@@ -153,10 +153,10 @@ Let’s look for overflow guards of the form ``v + b < v``, using the classes
153153
- a ``RelationalOperation``: the overflow comparison check.
154154
- a ``Variable``: used as an argument to both the addition and comparison.
155155

156-
- The ``where`` part of the query ties these three QL variables together using `predicates <https://help.semmle.com/QL/ql-handbook/predicates.html>`__ defined in the `standard QL for C/C++ library <https://help.semmle.com/qldoc/cpp/>`__.
156+
- The ``where`` part of the query ties these three variables together using `predicates <https://help.semmle.com/QL/ql-handbook/predicates.html>`__ defined in the `standard CodeQL for C/C++ library <https://help.semmle.com/qldoc/cpp/>`__.
157157

158-
QL query: bad overflow guards
159-
=============================
158+
CodeQL query: bad overflow guards
159+
=================================
160160

161161
We want to ensure the operands being added have size less than 4 bytes.
162162

@@ -180,8 +180,8 @@ We can get the size (in bytes) of a type using the ``getSize()`` method.
180180
- We therefore write a helper predicate for small expressions.
181181
- This predicate effectively represents the set of all expressions in the database where the size of the type of the expression is less than 4 bytes, that is, less than 32-bits.
182182

183-
QL query: bad overflow guards
184-
=============================
183+
CodeQL query: bad overflow guards
184+
==================================
185185

186186
We can ensure the operands being added have size less than 4 bytes, using our new predicate.
187187

@@ -216,8 +216,8 @@ Now our query becomes:
216216
- The “range” part, ``op = a.getAnOperand()``, restricts ``op`` to being one of the two operands to the addition.
217217
- The “condition” part, ``isSmall(op)``, says that the ``forall`` holds only if the condition (that the ``op`` is small) holds for everything in the range–that is, both the arguments to the addition.
218218

219-
QL query: bad overflow guards
220-
=============================
219+
CodeQL query: bad overflow guards
220+
=================================
221221

222222
Sometimes the result of the addition is cast to a small type of size less than 4 bytes, preventing automatic widening. We don’t want our query to flag these instances.
223223

docs/language/ql-training/cpp/control-flow-cpp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Analyzing control flow
33
======================
44

5-
QL for C/C++
5+
CodeQL for C/C++
66

77
.. container:: semmle-logo
88

@@ -226,7 +226,7 @@ A ``GuardCondition`` is a ``Boolean`` condition that controls one or more basic
226226
Further materials
227227
=================
228228

229-
- QL for C/C++: https://help.semmle.com/QL/learn-ql/ql/cpp/ql-for-cpp.html
229+
- CodeQL for C/C++: https://help.semmle.com/QL/learn-ql/ql/cpp/ql-for-cpp.html
230230
- API reference: https://help.semmle.com/qldoc/cpp
231231

232232
.. rst-class:: end-slide

docs/language/ql-training/cpp/data-flow-cpp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ Write a query that flags ``printf`` calls where the format argument is not a ``S
8686

8787
.. note::
8888

89-
This first query is about finding places where the format specifier is not a constant string. In QL for C/C++, constant strings are modeled as ``StringLiteral`` nodes, so we are looking for calls to format functions where the format specifier argument is not a string literal.
89+
This first query is about finding places where the format specifier is not a constant string. In CodeQL for C/C++, constant strings are modeled as ``StringLiteral`` nodes, so we are looking for calls to format functions where the format specifier argument is not a string literal.
9090

91-
The `C/C++ standard libraries <https://help.semmle.com/qldoc/cpp/>`__ include many different formatting functions that may be vulnerable to this particular attack–including ``printf``, ``snprintf``, and others. Furthermore, each of these different formatting functions may include the format string in a different position in the argument list. Instead of laboriously listing all these different variants, we can make use of the QL for C/C++ standard library class ``FormattingFunction``, which provides an interface that models common formatting functions in C/C++.
91+
The `C/C++ standard libraries <https://help.semmle.com/qldoc/cpp/>`__ include many different formatting functions that may be vulnerable to this particular attack–including ``printf``, ``snprintf``, and others. Furthermore, each of these different formatting functions may include the format string in a different position in the argument list. Instead of laboriously listing all these different variants, we can make use of the CodeQL for C/C++ standard library class ``FormattingFunction``, which provides an interface that models common formatting functions in C/C++.
9292

9393
Meh...
9494
======

docs/language/ql-training/cpp/global-data-flow-cpp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Introduction to global data flow
33
================================
44

5-
QL for C/C++
5+
CodeQL for C/C++
66

77
.. container:: semmle-logo
88

@@ -77,7 +77,7 @@ The library class ``SecurityOptions`` provides a (configurable) model of what co
7777
7878
.. note::
7979

80-
We first define what it means to be a *source* of tainted data for this particular problem. In this case, what we care about is whether the format string can be provided by an external user to our application or service. As there are many such ways external data could be introduced into the system, the standard QL libraries for C/C++ include an extensible API for modeling user input. In this case, we will simply use the predefined set of *user inputs*, which includes arguments provided to command line applications.
80+
We first define what it means to be a *source* of tainted data for this particular problem. In this case, what we care about is whether the format string can be provided by an external user to our application or service. As there are many such ways external data could be introduced into the system, the standard CodeQL libraries for C/C++ include an extensible API for modeling user input. In this case, we will simply use the predefined set of *user inputs*, which includes arguments provided to command line applications.
8181

8282

8383
Defining sinks (exercise)

0 commit comments

Comments
 (0)