Skip to content

Commit da16fad

Browse files
author
james
committed
Merge branch 'rc/1.26' into 126-mergeback
2 parents f8ad2ec + a165d2e commit da16fad

File tree

168 files changed

+4861
-3402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+4861
-3402
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Generate CodeQL query help documentation using Sphinx
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'rc/**'
8+
- 'lgtm.com'
9+
pull_request:
10+
paths:
11+
- '.github/workflows/generate-query-help-docs.yml'
12+
- 'docs/codeql/query-help/**'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Clone github/codeql
19+
uses: actions/checkout@v2
20+
with:
21+
path: codeql
22+
- name: Clone github/codeql-go
23+
uses: actions/checkout@v2
24+
with:
25+
repository: 'github/codeql-go'
26+
path: codeql-go
27+
- name: Set up Python 3.8
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.8
31+
- name: Download CodeQL CLI
32+
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
33+
with:
34+
repo: "github/codeql-cli-binaries"
35+
version: "latest"
36+
file: "codeql-linux64.zip"
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Unzip CodeQL CLI
39+
run: unzip -d codeql-cli codeql-linux64.zip
40+
- name: Set up query help docs folder
41+
run: |
42+
cp -r codeql/docs/codeql/** .
43+
- name: Query help to markdown
44+
run: |
45+
PATH="$PATH:codeql-cli/codeql" python codeql/docs/codeql/query-help-markdown.py
46+
- name: Run Sphinx for query help
47+
uses: ammaraskar/sphinx-action@8b4f60114d7fd1faeba1a712269168508d4750d2 # v0.4
48+
with:
49+
docs-folder: "query-help/"
50+
pre-build-command: "python -m pip install --upgrade recommonmark"
51+
build-command: "sphinx-build -b dirhtml . _build"
52+
- name: Upload HTML artifacts
53+
uses: actions/upload-artifact@v2
54+
with:
55+
name: query-help-html
56+
path: query-help/_build
57+

change-notes/1.26/analysis-python.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,34 @@ The following changes in version 1.26 affect Python analysis in all applications
44

55
## General improvements
66

7-
8-
## New queries
9-
10-
| **Query** | **Tags** | **Purpose** |
11-
|-----------------------------|-----------|--------------------------------------------------------------------|
12-
13-
147
## Changes to existing queries
158

169
| **Query** | **Expected impact** | **Change** |
1710
|----------------------------|------------------------|------------------------------------------------------------------|
18-
19-
11+
|`py/unsafe-deserialization` | Different results. | The underlying data flow library has been changed. See below for more details. |
12+
|`py/path-injection` | Different results. | The underlying data flow library has been changed. See below for more details. |
13+
|`py/command-line-injection` | Different results. | The underlying data flow library has been changed. See below for more details. |
14+
|`py/reflective-xss` | Different results. | The underlying data flow library has been changed. See below for more details. |
15+
|`py/sql-injection` | Different results. | The underlying data flow library has been changed. See below for more details. |
16+
|`py/code-injection` | Different results. | The underlying data flow library has been changed. See below for more details. |
2017
## Changes to libraries
21-
18+
* Some of the security queries now use the shared data flow library for data flow and taint tracking. This has resulted in an overall more robust and accurate analysis. The libraries mentioned below have been modelled in this new framework. Other libraries (e.g. the web framework `CherryPy`) have not been modelled yet, and this may lead to a temporary loss of results for these frameworks.
19+
* Improved modelling of the following serialization libraries:
20+
- `PyYAML`
21+
- `dill`
22+
- `pickle`
23+
- `marshal`
24+
* Improved modelling of the following web frameworks:
25+
- `Django` (Note that modelling of class-based response handlers is currently incomplete.)
26+
- `Flask`
27+
* Support for Werkzeug `MultiDict`.
28+
* Support for the [Python Database API Specification v2.0 (PEP-249)](https://www.python.org/dev/peps/pep-0249/), including the following libraries:
29+
- `MySQLdb`
30+
- `mysql-connector-python`
31+
- `django.db`
32+
* Improved modelling of the following command execution libraries:
33+
- `Fabric`
34+
- `Invoke`
35+
* Improved modelling of security-related standard library modules, such as `os`, `popen2`, `platform`, and `base64`.
36+
* The original versions of the updated queries have been preserved [here](https://github.com/github/codeql/tree/main/python/ql/src/experimental/Security-old-dataflow).
2237
* Added taint tracking support for string formatting through f-strings.

cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ module FlowVar_internal {
620620
private predicate largeVariable(Variable v, int liveBlocks, int defs) {
621621
liveBlocks = strictcount(SubBasicBlock sbb | variableLiveInSBB(sbb, v)) and
622622
defs = strictcount(SubBasicBlock sbb | exists(TBlockVar(sbb, v))) and
623-
liveBlocks * defs > 1000000
623+
// Convert to float to avoid int overflow (32-bit two's complement)
624+
liveBlocks.(float) * defs.(float) > 100000.0
624625
}
625626

626627
/**

docs/codeql/_templates/layout.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,19 @@
3838
{%- block content %}
3939
<header class="Header">
4040
<div class="Header-item--full">
41-
<a href="{{ pathto(master_doc) }}" class="Header-link f2 d-flex flex-items-center">
41+
<a href="https://codeql.github.com/docs" class="Header-link f2 d-flex flex-items-center">
4242
<!-- <%= octicon "mark-github", class: "mr-2", height: 32 %> -->
4343
<svg height="32" class="octicon octicon-mark-github mr-2" viewBox="0 0 16 16" version="1.1" width="32"
4444
aria-hidden="true">
4545
<path fill-rule="evenodd"
4646
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z">
4747
</path>
4848
</svg>
49-
<span class="hide-sm">{{ project }}</span>
49+
<span class="hide-sm">CodeQL documentation</span>
5050
</a>
5151
</div>
5252
<div class="Header-item hide-sm hide-md">
53-
<form class="search" action="{{ pathto('search') }}" method="get">
54-
<input class="form-control input-dark" type="text" name="q" placeholder="Search" />
55-
<input class="btn" type="submit" value="Search" />
56-
<input type="hidden" name="check_keywords" value="yes" />
57-
<input type="hidden" name="area" value="default" />
58-
</form>
59-
<script type="text/javascript">$('#searchbox').show(0);</script>
60-
61-
<div class="clearer"></div>
53+
<script src="https://addsearch.com/js/?key=93b4d287e2fc079a4089412b669785d5&categories=!0xhelp.semmle.com,0xcodeql.github.com,1xdocs,1xcodeql-standard-libraries,1xcodeql-query-help"></script>
6254
</div>
6355
<div class="Header-item">
6456

@@ -69,20 +61,30 @@
6961
</summary>
7062

7163
<ul class="dropdown-menu dropdown-menu-se dropdown-menu-dark">
64+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/codeql-overview">CodeQL overview</a></li>
65+
<li class="dropdown-divider" role="separator"></li>
7266
<div class="dropdown-header">
73-
Help docs
67+
CodeQL tools
7468
</div>
75-
<li><a class="dropdown-item" href="https://help.semmle.com/QL/learn-ql/">Learn CodeQL</a></li>
76-
<li><a class="dropdown-item" href="https://help.semmle.com/codeql/codeql-tools.html">CodeQL tools</a>
69+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/codeql-for-visual-studio-code">CodeQL for VS Code</a>
70+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/codeql-cli">CodeQL CLI</a>
7771
</li>
7872
<li class="dropdown-divider" role="separator"></li>
73+
<div class="dropdown-header">
74+
CodeQL guides
75+
</div>
76+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/writing-codeql-queries">Writing CodeQL queries</a></li>
77+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/codeql-language-guides">CodeQL language guides</a>
78+
<li class="dropdown-divider" role="separator"></li>
7979
<div class="dropdown-header">
8080
Reference docs
8181
</div>
82-
<li><a class="dropdown-item" href="https://help.semmle.com/QL/ql-handbook/">QL language reference</a>
83-
<li><a class="dropdown-item" href="https://help.semmle.com/QL/ql-libraries.html">CodeQL libraries</a>
84-
<li><a class="dropdown-item" href="https://help.semmle.com/QL/ql-built-in-queries.html">CodeQL
85-
queries</a>
82+
<li><a class="dropdown-item" href="https://codeql.github.com/docs/ql-language-reference/">QL language
83+
reference</a>
84+
<li><a class="dropdown-item" href="https://codeql.github.com/codeql-standard-libraries">CodeQL
85+
standard-libraries</a>
86+
<li><a class="dropdown-item" href="https://codeql.github.com/codeql-query-help">CodeQL
87+
query help</a>
8688
<li class="dropdown-divider" role="separator"></li>
8789
<div class="dropdown-header">
8890
Source files

docs/codeql/codeql-cli/codeql-cli-reference/about-ql-packs.rst renamed to docs/codeql/codeql-cli/about-ql-packs.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ The following properties are supported in ``qlpack.yml`` files.
8585
* - ``suites``
8686
- ``suites``
8787
- Optional
88-
- The path to a directory that contains the "well-known" query suites in the pack, defined relative to the pack directory. You can run "well-known" suites stored in this directory by specifying the pack name, without providing their full path. To use query suites stored in other directories in the pack, you must provide their full path. For more information about query suites, see ":doc:`Creating CodeQL query suites <../using-the-codeql-cli/creating-codeql-query-suites>`."
88+
- The path to a directory that contains the "well-known" query suites in the pack, defined relative to the pack directory. You can run "well-known" suites stored in this directory by specifying the pack name, without providing their full path. To use query suites stored in other directories in the pack, you must provide their full path. For more information about query suites, see ":doc:`Creating CodeQL query suites <creating-codeql-query-suites>`."
8989
* - ``extractor``
9090
- ``javascript``
9191
- All test packs
92-
- The CodeQL language extractor to use when the CLI creates a database from test files in the pack. For more information about testing queries, see ":doc:`Testing custom queries <../using-the-codeql-cli/testing-custom-queries>`."
92+
- The CodeQL language extractor to use when the CLI creates a database from test files in the pack. For more information about testing queries, see ":doc:`Testing custom queries <testing-custom-queries>`."
9393
* - ``tests``
9494
- ``.``
9595
- Optional for test packs
@@ -124,7 +124,7 @@ and ``libraryPathDependencies`` properties. If the pack contains query suites, y
124124
use the ``suites`` property to define their location. Query suites defined
125125
here are called "well-known" suites, and can be used on the command line by referring to
126126
their name only, rather than their full path.
127-
For more information about query suites, see ":doc:`Creating CodeQL query suites <../using-the-codeql-cli/creating-codeql-query-suites>`."
127+
For more information about query suites, see ":doc:`Creating CodeQL query suites <creating-codeql-query-suites>`."
128128

129129
For example, a ``qlpack.yml`` file for a QL pack featuring custom C++ queries
130130
and libraries may contain:
@@ -154,10 +154,10 @@ For custom QL packs containing test files, you also need to include an
154154
``extractor`` property so that the ``test run`` command knows how to create test
155155
databases. You may also wish to specify the ``tests`` property.
156156

157-
.. include:: ../../reusables/test-qlpack.rst
157+
.. include:: ../reusables/test-qlpack.rst
158158

159159
For more information about running tests, see ":doc:`Testing custom queries
160-
<../using-the-codeql-cli/testing-custom-queries>`."
160+
<testing-custom-queries>`."
161161

162162
.. _standard-ql-packs:
163163

docs/codeql/codeql-cli/using-the-codeql-cli/about-the-codeql-cli.rst renamed to docs/codeql/codeql-cli/about-the-codeql-cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ command line. To run a command, use::
2626
codeql [command] [subcommand]
2727

2828
To view the reference documentation for a command, add the ``--help`` flag, or visit the
29-
"`CodeQL CLI manual <../../codeql-cli-manual>`__."
29+
"`CodeQL CLI manual <../manual>`__."

docs/codeql/codeql-cli/using-the-codeql-cli/analyzing-databases-with-the-codeql-cli.rst renamed to docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CodeQL analyses produce :ref:`interpreted results
1111
For information about writing queries to run with ``database analyze``, see
1212
":doc:`Using custom queries with the CodeQL CLI <using-custom-queries-with-the-codeql-cli>`."
1313

14-
.. include:: ../../reusables/advanced-query-execution.rst
14+
.. include:: ../reusables/advanced-query-execution.rst
1515

1616
Before starting an analysis you must:
1717

@@ -49,13 +49,13 @@ You must specify:
4949
<sarif-file>`, and graph formats. For more information about CSV and SARIF,
5050
see `Results <#results>`__. To find out which other results formats are
5151
supported, see the `database analyze reference
52-
<../codeql-cli-manual/database-analyze.html>`__.
52+
<../manual/database-analyze>`__.
5353

5454
- ``--output``: the output path of the results file generated during analysis.
5555

5656
You can also specify:
5757

58-
- .. include:: ../../reusables/threads-query-execution.rst
58+
- .. include:: ../reusables/threads-query-execution.rst
5959

6060

6161
.. pull-quote::
@@ -70,7 +70,7 @@ You can also specify:
7070
<upgrading-codeql-databases>`."
7171

7272
For full details of all the options you can use when analyzing databases, see
73-
the `database analyze reference documentation <../codeql-cli-manual/database-analyze.html>`__.
73+
the `database analyze reference documentation <../manual/database-analyze>`__.
7474

7575
.. _database-analyze-examples:
7676

@@ -149,7 +149,7 @@ recursively, so any queries contained in subfolders will also be executed.
149149
Important
150150

151151
You shouldn't specify the root of a :doc:`QL pack
152-
<../codeql-cli-reference/about-ql-packs>` when executing ``database analyze``
152+
<about-ql-packs>` when executing ``database analyze``
153153
as it contains some special queries that aren't designed to be used with
154154
the command. Rather, to run a wide range of useful queries, run one of the
155155
LGTM.com query suites.
@@ -171,7 +171,7 @@ You can save analysis results in a number of different formats, including SARIF
171171
and CSV.
172172

173173
The SARIF format is designed to represent the output of a broad range of static
174-
analysis tools. For more information, see :doc:`SARIF output <../codeql-cli-reference/sarif-output>`.
174+
analysis tools. For more information, see :doc:`SARIF output <sarif-output>`.
175175

176176
If you choose to generate results in CSV format, then each line in the output file
177177
corresponds to an alert. Each line is a comma-separated list with the following information:

docs/codeql/codeql-cli/codeql-cli-reference/index.rst renamed to docs/codeql/codeql-cli/codeql-cli-reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ CodeQL CLI manual
2828
-----------------
2929

3030
To view detailed information about each CodeQL CLI command,
31-
including its usage and options, add the ``--help`` flag or visit the "`CodeQL CLI manual <../codeql-cli-manual>`__."
31+
including its usage and options, add the ``--help`` flag or visit the "`CodeQL CLI manual <../manual>`__."

docs/codeql/codeql-cli/using-the-codeql-cli/creating-codeql-databases.rst renamed to docs/codeql/codeql-cli/creating-codeql-databases.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ You must specify:
3535
- ``--language``: the identifier for the language to create a database for.
3636
CodeQL supports creating databases for the following languages:
3737

38-
.. include:: ../../reusables/extractors.rst
38+
.. include:: ../reusables/extractors.rst
3939

4040
Other options may be specified depending on the location of your source file and
4141
the language you want to analyze:
@@ -50,7 +50,7 @@ the language you want to analyze:
5050
detect the build system automatically, using a built-in autobuilder.
5151

5252
For full details of all the options you can use when creating databases,
53-
see the `database create reference documentation <../codeql-cli-manual/database-create.html>`__.
53+
see the `database create reference documentation <../manual/database-create>`__.
5454

5555
Progress and results
5656
--------------------
@@ -75,7 +75,7 @@ CodeQL. For each project on LGTM.com, you can download an archived CodeQL
7575
database corresponding to the most recently analyzed revision of the code. These
7676
databases can also be analyzed using the CodeQL CLI.
7777

78-
.. include:: ../../reusables/download-lgtm-database.rst
78+
.. include:: ../reusables/download-lgtm-database.rst
7979

8080
Before running an analysis, unzip the databases and try :doc:`upgrading <upgrading-codeql-databases>` the
8181
unzipped databases to ensure they are compatible with your local copy of the
@@ -85,7 +85,7 @@ CodeQL queries and libraries.
8585

8686
Note
8787

88-
.. include:: ../../reusables/index-files-note.rst
88+
.. include:: ../reusables/index-files-note.rst
8989

9090
Creating databases for non-compiled languages
9191
---------------------------------------------

docs/codeql/codeql-cli/using-the-codeql-cli/creating-codeql-query-suites.rst renamed to docs/codeql/codeql-cli/creating-codeql-query-suites.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ suite definition have been executed, the result is a set of selected queries.
1919
.. note::
2020

2121
Any custom queries that you want to add to a query suite must be in a :doc:`QL
22-
pack <../codeql-cli-reference/about-ql-packs>` and contain the correct query metadata.
22+
pack <about-ql-packs>` and contain the correct query metadata.
2323
For more information, see
2424
":doc:`Using custom queries with the CodeQL CLI <using-custom-queries-with-the-codeql-cli>`."
2525

@@ -234,7 +234,7 @@ instruction::
234234
- description: <name-of-query-suite>
235235

236236
This value is displayed when you run `codeql resolve queries
237-
<../codeql-cli-manual/resolve-queries.html>`__, if the suite is added to a "well-known"
237+
<../manual/resolve-queries>`__, if the suite is added to a "well-known"
238238
directory. For more information, see "`Specifying well-known query suites
239239
<#specifying-well-known-query-suites>`__."
240240

@@ -254,7 +254,7 @@ without providing their full path. This gives you a simple way of specifying a
254254
set of queries, without needing to search inside QL packs and distributions.
255255
To declare a directory that contains "well-known" query suites, add the directory
256256
to the ``suites`` property in the ``qlpack.yml`` file at the root of your QL pack.
257-
For more information, see "`About QL packs <../codeql-cli-reference/qlpack-overview.html#qlpack-yml-properties>`__."
257+
For more information, see "`About QL packs <qlpack-overview.html#qlpack-yml-properties>`__."
258258

259259
Using query suites with CodeQL
260260
------------------------------

0 commit comments

Comments
 (0)