Skip to content

Commit 6aeec58

Browse files
committed
Merge branch 'main' into rdmarsh2/cpp/operand-reuse
2 parents 631ee28 + 8db234f commit 6aeec58

File tree

1,569 files changed

+156903
-25919
lines changed

Some content is hidden

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

1,569 files changed

+156903
-25919
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ name: "Code scanning - action"
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- 'rc/*'
58
pull_request:
9+
branches:
10+
- main
11+
- 'rc/*'
612
schedule:
713
- cron: '0 9 * * 1'
814

@@ -14,16 +20,7 @@ jobs:
1420
steps:
1521
- name: Checkout repository
1622
uses: actions/checkout@v2
17-
with:
18-
# We must fetch at least the immediate parents so that if this is
19-
# a pull request then we can checkout the head.
20-
fetch-depth: 2
21-
22-
# If this run was triggered by a pull request event, then checkout
23-
# the head of the pull request instead of the merge commit.
24-
- run: git checkout HEAD^2
25-
if: ${{ github.event_name == 'pull_request' }}
26-
23+
2724
# Initializes the CodeQL tools for scanning.
2825
- name: Initialize CodeQL
2926
uses: github/codeql-action/init@v1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Generate CodeQL query help documentation using Sphinx
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
description:
7+
description: A description of the purpose of this job. For human consumption.
8+
required: false
9+
push:
10+
branches:
11+
- 'lgtm.com'
12+
pull_request:
13+
paths:
14+
- '.github/workflows/generate-query-help-docs.yml'
15+
- 'docs/codeql/query-help/**'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Clone github/codeql
22+
uses: actions/checkout@v2
23+
with:
24+
path: codeql
25+
- name: Clone github/codeql-go
26+
uses: actions/checkout@v2
27+
with:
28+
repository: 'github/codeql-go'
29+
path: codeql-go
30+
- name: Set up Python 3.8
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.8
34+
- name: Download CodeQL CLI
35+
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
36+
with:
37+
repo: "github/codeql-cli-binaries"
38+
version: "latest"
39+
file: "codeql-linux64.zip"
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Unzip CodeQL CLI
42+
run: unzip -d codeql-cli codeql-linux64.zip
43+
- name: Set up query help docs folder
44+
run: |
45+
cp -r codeql/docs/codeql/** .
46+
- name: Query help to markdown
47+
run: |
48+
PATH="$PATH:codeql-cli/codeql" python codeql/docs/codeql/query-help-markdown.py
49+
- name: Run Sphinx for query help
50+
uses: ammaraskar/sphinx-action@8b4f60114d7fd1faeba1a712269168508d4750d2 # v0.4
51+
with:
52+
docs-folder: "query-help/"
53+
pre-build-command: "python -m pip install --upgrade recommonmark && python -m pip install --upgrade sphinx-markdown-tables"
54+
build-command: "sphinx-build -b dirhtml . _build"
55+
- name: Upload HTML artifacts
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: query-help-html
59+
path: query-help/_build
60+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# Byte-compiled python files
1818
*.pyc
1919

20+
# python virtual environment folder
21+
.venv/
22+
2023
# It's useful (though not required) to be able to unpack codeql in the ql checkout itself
2124
/codeql/
2225

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ If you have an idea for a query that you would like to share with other CodeQL u
3838

3939
- The queries and libraries must be autoformatted, for example using the "Format Document" command in [CodeQL for Visual Studio Code](https://help.semmle.com/codeql/codeql-for-vscode/procedures/about-codeql-for-vscode.html).
4040

41+
If you prefer, you can use this [pre-commit hook](misc/scripts/pre-commit) that automatically checks whether your files are correctly formatted. See the [pre-commit hook installation guide](docs/install-pre-commit-hook.md) for instructions on how to install the hook.
42+
4143
4. **Compilation**
4244

4345
- Compilation of the query and any associated libraries and tests must be resilient to future development of the [supported](docs/supported-queries.md) libraries. This means that the functionality cannot use internal libraries, cannot depend on the output of `getAQlClass`, and cannot make use of regexp matching on `toString`.

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.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm
2+
* A new query (`cpp/unsigned-difference-expression-compared-zero`) is run but not yet displayed on LGTM. The query finds unsigned subtractions used in relational comparisons with the value 0. This query was originally submitted as an experimental query by @ihsinme in https://github.com/github/codeql/pull/4745.

cpp/config/suites/cpp/correctness

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql: /Correctness/Dangerous Conversions
1111
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
1212
+ semmlecode-cpp-queries/Likely Bugs/OO/UnsafeUseOfThis.ql: /Correctness/Dangerous Conversions
13+
+ semmlecode-cpp-queries/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero.ql: /Correctness/Dangerous Conversions
1314
# Consistent Use
1415
+ semmlecode-cpp-queries/Critical/ReturnValueIgnored.ql: /Correctness/Consistent Use
1516
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCheckReturnNull.ql: /Correctness/Consistent Use

cpp/ql/src/Architecture/General Class-Level Information/ClassHierarchies.ql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
* @kind graph
55
* @id cpp/architecture/class-hierarchies
66
* @graph.layout organic
7-
* @workingset jhotdraw
8-
* @result succeed 48
9-
* @result_ondemand succeed 48
107
* @tags maintainability
118
*/
129

cpp/ql/src/Architecture/General Class-Level Information/InheritanceDepthDistribution.ql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
* @kind chart
55
* @id cpp/architecture/inheritance-depth-distribution
66
* @chart.type line
7-
* @workingset jhotdraw
8-
* @result succeed 48
9-
* @result_ondemand succeed 48
107
* @tags maintainability
118
*/
129

cpp/ql/src/Architecture/General Namespace-Level Information/GlobalNamespaceClasses.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/**
22
* @name Global namespace classes
33
* @description Finds classes that belong to no namespace.
4-
* @kind table
4+
* @kind problem
5+
* @problem.severity recommendation
56
* @id cpp/architecture/global-namespace-classes
67
* @tags maintainability
78
* modularity

0 commit comments

Comments
 (0)