Skip to content

Commit f620e25

Browse files
committed
Merge branch 'main' into py/add-ssrf-sinks
2 parents e47f726 + c514282 commit f620e25

File tree

414 files changed

+32252
-31645
lines changed

Some content is hidden

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

414 files changed

+32252
-31645
lines changed

.github/workflows/ruby-qltest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
qltest:
6464
runs-on: ubuntu-latest
6565
strategy:
66+
fail-fast: false
6667
matrix:
6768
slice: ["1/2", "2/2"]
6869
steps:

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v3.2.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
11+
- repo: local
12+
hooks:
13+
- id: codeql-format
14+
name: Fix QL file formatting
15+
files: \.qll?$
16+
language: system
17+
entry: codeql query format --in-place
18+
19+
- id: sync-files
20+
name: Fix files required to be identical
21+
language: system
22+
entry: python3 config/sync-files.py --latest
23+
pass_filenames: false
24+
25+
- id: qhelp
26+
name: Check query help generation
27+
files: \.qhelp$
28+
language: system
29+
entry: python3 misc/scripts/check-qhelp.py

CONTRIBUTING.md

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

4343
- 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).
4444

45-
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/pre-commit-hook-setup.md) for instructions on how to install the hook.
45+
If you prefer, you can either:
46+
1. install the [pre-commit framework](https://pre-commit.com/) and install the configured hooks on this repo via `pre-commit install`, or
47+
2. use this [pre-commit hook](misc/scripts/pre-commit) that automatically checks whether your files are correctly formatted.
48+
49+
See the [pre-commit hook installation guide](docs/pre-commit-hook-setup.md) for instructions on the two approaches.
4650

4751
4. **Compilation**
4852

@@ -63,6 +67,6 @@ After the experimental query is merged, we welcome pull requests to improve it.
6367

6468
## Using your personal data
6569

66-
If you contribute to this project, we will record your name and email address (as provided by you with your contributions) as part of the code repositories, which are public. We might also use this information to contact you in relation to your contributions, as well as in the normal course of software development. We also store records of CLA agreements signed in the past, but no longer require contributors to sign a CLA. Under GDPR legislation, we do this on the basis of our legitimate interest in creating the CodeQL product.
70+
If you contribute to this project, we will record your name and email address (as provided by you with your contributions) as part of the code repositories, which are public. We might also use this information to contact you in relation to your contributions, as well as in the normal course of software development. We also store records of CLA agreements signed in the past, but no longer require contributors to sign a CLA. Under GDPR legislation, we do this on the basis of our legitimate interest in creating the CodeQL product.
6771

6872
Please do get in touch ([email protected]) if you have any questions about this or our data protection policies.

cpp/ql/lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.0.10
2+
3+
### New Features
4+
5+
* Added a `isStructuredBinding` predicate to the `Variable` class which holds when the variable is declared as part of a structured binding declaration.
6+
17
## 0.0.9
28

39
## 0.0.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Many queries now support structured bindings, as structured bindings are now handled in the IR translation.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
---
2-
category: feature
3-
---
1+
## 0.0.10
2+
3+
### New Features
4+
45
* Added a `isStructuredBinding` predicate to the `Variable` class which holds when the variable is declared as part of a structured binding declaration.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.0.9
2+
lastReleaseVersion: 0.0.10

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.0.10-dev
2+
version: 0.0.11-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

cpp/ql/lib/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ private module Cached {
241241
// For compatibility, send flow from arguments to parameters, even for
242242
// functions with no body.
243243
exists(FunctionCall call, int i |
244-
sink.asExpr() = call.getArgument(i) and
245-
result = resolveCall(call).getParameter(i)
244+
sink.asExpr() = call.getArgument(pragma[only_bind_into](i)) and
245+
result = resolveCall(call).getParameter(pragma[only_bind_into](i))
246246
)
247247
or
248248
// For compatibility, send flow into a `Variable` if there is flow to any

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ private predicate filteredNumberableInstruction(Instruction instr) {
106106
or
107107
instr instanceof FieldAddressInstruction and
108108
count(instr.(FieldAddressInstruction).getField()) != 1
109+
or
110+
instr instanceof InheritanceConversionInstruction and
111+
(
112+
count(instr.(InheritanceConversionInstruction).getBaseClass()) != 1 or
113+
count(instr.(InheritanceConversionInstruction).getDerivedClass()) != 1
114+
)
109115
}
110116

111117
private predicate variableAddressValueNumber(
@@ -115,8 +121,7 @@ private predicate variableAddressValueNumber(
115121
// The underlying AST element is used as value-numbering key instead of the
116122
// `IRVariable` to work around a problem where a variable or expression with
117123
// multiple types gives rise to multiple `IRVariable`s.
118-
instr.getIRVariable().getAST() = ast and
119-
strictcount(instr.getIRVariable().getAST()) = 1
124+
unique( | | instr.getIRVariable().getAST()) = ast
120125
}
121126

122127
private predicate initializeParameterValueNumber(
@@ -133,8 +138,7 @@ private predicate constantValueNumber(
133138
ConstantInstruction instr, IRFunction irFunc, IRType type, string value
134139
) {
135140
instr.getEnclosingIRFunction() = irFunc and
136-
strictcount(instr.getResultIRType()) = 1 and
137-
instr.getResultIRType() = type and
141+
unique( | | instr.getResultIRType()) = type and
138142
instr.getValue() = value
139143
}
140144

@@ -151,8 +155,7 @@ private predicate fieldAddressValueNumber(
151155
TValueNumber objectAddress
152156
) {
153157
instr.getEnclosingIRFunction() = irFunc and
154-
instr.getField() = field and
155-
strictcount(instr.getField()) = 1 and
158+
unique( | | instr.getField()) = field and
156159
tvalueNumber(instr.getObjectAddress()) = objectAddress
157160
}
158161

@@ -195,9 +198,9 @@ private predicate inheritanceConversionValueNumber(
195198
) {
196199
instr.getEnclosingIRFunction() = irFunc and
197200
instr.getOpcode() = opcode and
198-
instr.getBaseClass() = baseClass and
199-
instr.getDerivedClass() = derivedClass and
200-
tvalueNumber(instr.getUnary()) = operand
201+
tvalueNumber(instr.getUnary()) = operand and
202+
unique( | | instr.getBaseClass()) = baseClass and
203+
unique( | | instr.getDerivedClass()) = derivedClass
201204
}
202205

203206
private predicate loadTotalOverlapValueNumber(

0 commit comments

Comments
 (0)