Skip to content

Commit 9406aa2

Browse files
committed
Merge remote-tracking branch 'origin/main' into nickrolfe/constant_regexp
2 parents a9eac19 + af1d949 commit 9406aa2

File tree

108 files changed

+3670
-1817
lines changed

Some content is hidden

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

108 files changed

+3670
-1817
lines changed

.github/workflows/ql-for-ql-build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- name: Find codeql
1818
id: find-codeql
19-
uses: github/codeql-action/init@erik-krogh/ql
19+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
2020
with:
2121
languages: javascript # does not matter
22+
tools: latest
2223
- name: Get CodeQL version
2324
id: get-codeql-version
2425
run: |
@@ -159,7 +160,7 @@ jobs:
159160
PACK: ${{ runner.temp }}/pack
160161
- name: Hack codeql-action options
161162
run: |
162-
JSON=$(jq -nc --arg pack "${PACK}" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
163+
JSON=$(jq -nc --arg pack "${PACK}" '.database."run-queries"=["--search-path", $pack] | .resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
163164
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
164165
env:
165166
PACK: ${{ runner.temp }}/pack
@@ -171,22 +172,25 @@ jobs:
171172
echo "paths:" > ${CONF}
172173
echo " - ${FOLDER}" >> ${CONF}
173174
echo "paths-ignore:" >> ${CONF}
174-
echo " - ql/ql/test" >> ${CONF}
175+
echo " - ql/ql/test" >> ${CONF}
176+
echo "disable-default-queries: true" >> ${CONF}
177+
echo "packs:" >> ${CONF}
178+
echo " - codeql/ql" >> ${CONF}
175179
echo "Config file: "
176180
cat ${CONF}
177181
env:
178182
CONF: ./ql-for-ql-config.yml
179183
FOLDER: ${{ matrix.folder }}
180-
181184
- name: Initialize CodeQL
182-
uses: github/codeql-action/init@erik-krogh/ql
185+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
183186
with:
184187
languages: ql
185188
db-location: ${{ runner.temp }}/db
186189
config-file: ./ql-for-ql-config.yml
190+
tools: latest
187191

188192
- name: Perform CodeQL Analysis
189-
uses: github/codeql-action/analyze@erik-krogh/ql
193+
uses: github/codeql-action/analyze@aa93aea877e5fb8841bcb1193f672abf6e9f2980
190194
with:
191195
category: "ql-for-ql-${{ matrix.folder }}"
192196
- name: Copy sarif file to CWD

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Find codeql
2828
id: find-codeql
29-
uses: github/codeql-action/init@erik-krogh/ql
29+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
3030
with:
3131
languages: javascript # does not matter
3232
- uses: actions/cache@v2

.github/workflows/ql-for-ql-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v2
2121
- name: Find codeql
2222
id: find-codeql
23-
uses: github/codeql-action/init@erik-krogh/ql
23+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
2424
with:
2525
languages: javascript # does not matter
2626
- uses: actions/cache@v2

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase {
161161
*/
162162
pragma[noinline]
163163
final IRBlock dominanceFrontier() {
164-
this.dominates(result.getAPredecessor()) and
165-
not this.strictlyDominates(result)
164+
this.getASuccessor() = result and
165+
not this.immediatelyDominates(result)
166+
or
167+
exists(IRBlock prev | result = prev.dominanceFrontier() |
168+
this.immediatelyDominates(prev) and
169+
not this.immediatelyDominates(result)
170+
)
166171
}
167172

168173
/**
@@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase {
201206
*/
202207
pragma[noinline]
203208
final IRBlock postDominanceFrontier() {
204-
this.postDominates(result.getASuccessor()) and
205-
not this.strictlyPostDominates(result)
209+
this.getAPredecessor() = result and
210+
not this.immediatelyPostDominates(result)
211+
or
212+
exists(IRBlock prev | result = prev.postDominanceFrontier() |
213+
this.immediatelyPostDominates(prev) and
214+
not this.immediatelyPostDominates(result)
215+
)
206216
}
207217

208218
/**

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase {
161161
*/
162162
pragma[noinline]
163163
final IRBlock dominanceFrontier() {
164-
this.dominates(result.getAPredecessor()) and
165-
not this.strictlyDominates(result)
164+
this.getASuccessor() = result and
165+
not this.immediatelyDominates(result)
166+
or
167+
exists(IRBlock prev | result = prev.dominanceFrontier() |
168+
this.immediatelyDominates(prev) and
169+
not this.immediatelyDominates(result)
170+
)
166171
}
167172

168173
/**
@@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase {
201206
*/
202207
pragma[noinline]
203208
final IRBlock postDominanceFrontier() {
204-
this.postDominates(result.getASuccessor()) and
205-
not this.strictlyPostDominates(result)
209+
this.getAPredecessor() = result and
210+
not this.immediatelyPostDominates(result)
211+
or
212+
exists(IRBlock prev | result = prev.postDominanceFrontier() |
213+
this.immediatelyPostDominates(prev) and
214+
not this.immediatelyPostDominates(result)
215+
)
206216
}
207217

208218
/**

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ private predicate ignoreSideEffects(Expr expr) {
154154
* around extractor bugs. Once the relevant extractor bugs are fixed, this predicate can be removed.
155155
*/
156156
private predicate isInvalidFunction(Function func) {
157-
exists(Literal literal |
158-
// Constructor field inits within a compiler-generated copy constructor have a source expression
159-
// that is a `Literal` with no value.
160-
literal = func.(Constructor).getAnInitializer().(ConstructorFieldInit).getExpr() and
161-
not exists(literal.getValue())
162-
)
163-
or
164157
exists(ThisExpr thisExpr |
165158
// An instantiation of a member function template is not treated as a `MemberFunction` if it has
166159
// only non-type template arguments.

cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,13 @@ class IRBlock extends IRBlockBase {
161161
*/
162162
pragma[noinline]
163163
final IRBlock dominanceFrontier() {
164-
this.dominates(result.getAPredecessor()) and
165-
not this.strictlyDominates(result)
164+
this.getASuccessor() = result and
165+
not this.immediatelyDominates(result)
166+
or
167+
exists(IRBlock prev | result = prev.dominanceFrontier() |
168+
this.immediatelyDominates(prev) and
169+
not this.immediatelyDominates(result)
170+
)
166171
}
167172

168173
/**
@@ -201,8 +206,13 @@ class IRBlock extends IRBlockBase {
201206
*/
202207
pragma[noinline]
203208
final IRBlock postDominanceFrontier() {
204-
this.postDominates(result.getASuccessor()) and
205-
not this.strictlyPostDominates(result)
209+
this.getAPredecessor() = result and
210+
not this.immediatelyPostDominates(result)
211+
or
212+
exists(IRBlock prev | result = prev.postDominanceFrontier() |
213+
this.immediatelyPostDominates(prev) and
214+
not this.immediatelyPostDominates(result)
215+
)
206216
}
207217

208218
/**

cpp/ql/src/Security/CWE/CWE-497/ExposedSystemData.qhelp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>Exposing system data or debugging information may help an adversary to learn about the system and form an attack plan. An attacker can use error messages that reveal technologies, operating systems, and product versions to tune their attack against known vulnerabilities in these technologies.</p>
6+
<p>Exposing system data or debugging information may help a malicious user learn about the system and form an attack plan. An attacker can use error messages that reveal technologies, operating systems, and product versions to tune their attack against known vulnerabilities in the software.</p>
77

8-
<p>This query finds locations where system configuration information might be revealed to a user.</p>
8+
<p>This query finds locations where system configuration information might be revealed to a remote user.</p>
99
</overview>
1010

1111
<recommendation>
12-
<p>Do not expose system configuration information to users. Be wary of the difference between information that could be helpful to users, and unnecessary details that could be useful to an adversary.</p>
12+
<p>Do not expose system configuration information to remote users. Be wary of the difference between information that could be helpful to users, and unnecessary details that could be useful to a malicious user.</p>
1313
</recommendation>
1414

1515
<example>
16-
<p>In this example the value of the <code>PATH</code> environment variable is revealed in full to the user when a particular error occurs. This might reveal information such as the software installed on your system to an adversary who does not have legitimate access to that information.</p>
16+
<p>In this example the value of the <code>PATH</code> environment variable is revealed in full to the user when a particular error occurs. This might reveal information such as the software installed on your system to a malicious user who does not have legitimate access to that information.</p>
1717

1818
<sample src="ExposedSystemDataIncorrect.cpp" />
1919

0 commit comments

Comments
 (0)