Skip to content

Commit 4534d67

Browse files
authored
Merge branch 'main' into changedocs-2.23.2
2 parents 9c610e8 + d39c8d1 commit 4534d67

File tree

588 files changed

+24050
-5779
lines changed

Some content is hidden

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

588 files changed

+24050
-5779
lines changed

Cargo.lock

Lines changed: 75 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MODULE.bazel

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ use_repo(
9898
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")
9999
use_repo(
100100
tree_sitter_extractors_deps,
101-
"vendor_ts__anyhow-1.0.99",
101+
"vendor_ts__anyhow-1.0.100",
102102
"vendor_ts__argfile-0.2.1",
103103
"vendor_ts__chalk-ir-0.104.0",
104104
"vendor_ts__chrono-0.4.42",
105-
"vendor_ts__clap-4.5.47",
105+
"vendor_ts__clap-4.5.48",
106106
"vendor_ts__dunce-1.0.5",
107107
"vendor_ts__either-1.15.0",
108108
"vendor_ts__encoding-0.2.33",
@@ -116,7 +116,7 @@ use_repo(
116116
"vendor_ts__num-traits-0.2.19",
117117
"vendor_ts__num_cpus-1.17.0",
118118
"vendor_ts__proc-macro2-1.0.101",
119-
"vendor_ts__quote-1.0.40",
119+
"vendor_ts__quote-1.0.41",
120120
"vendor_ts__ra_ap_base_db-0.0.301",
121121
"vendor_ts__ra_ap_cfg-0.0.301",
122122
"vendor_ts__ra_ap_hir-0.0.301",
@@ -135,17 +135,17 @@ use_repo(
135135
"vendor_ts__ra_ap_vfs-0.0.301",
136136
"vendor_ts__rand-0.9.2",
137137
"vendor_ts__rayon-1.11.0",
138-
"vendor_ts__regex-1.11.2",
139-
"vendor_ts__serde-1.0.219",
140-
"vendor_ts__serde_json-1.0.143",
141-
"vendor_ts__serde_with-3.14.0",
138+
"vendor_ts__regex-1.11.3",
139+
"vendor_ts__serde-1.0.228",
140+
"vendor_ts__serde_json-1.0.145",
141+
"vendor_ts__serde_with-3.14.1",
142142
"vendor_ts__syn-2.0.106",
143-
"vendor_ts__toml-0.9.5",
143+
"vendor_ts__toml-0.9.7",
144144
"vendor_ts__tracing-0.1.41",
145145
"vendor_ts__tracing-flame-0.2.0",
146146
"vendor_ts__tracing-subscriber-0.3.20",
147147
"vendor_ts__tree-sitter-0.25.9",
148-
"vendor_ts__tree-sitter-embedded-template-0.23.2",
148+
"vendor_ts__tree-sitter-embedded-template-0.25.0",
149149
"vendor_ts__tree-sitter-json-0.24.8",
150150
"vendor_ts__tree-sitter-ql-0.23.1",
151151
"vendor_ts__tree-sitter-ruby-0.23.1",

actions/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/actions-all
2-
version: 0.4.18
2+
version: 0.4.19-dev
33
library: true
44
warnOnImplicitThis: true
55
dependencies:

actions/ql/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/actions-queries
2-
version: 0.6.10
2+
version: 0.6.11-dev
33
library: false
44
warnOnImplicitThis: true
55
groups: [actions, queries]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: breaking
3+
---
4+
* The "Guards" libraries (`semmle.code.cpp.controlflow.Guards` and `semmle.code.cpp.controlflow.IRGuards`) have been totally rewritten to recognize many more guards. The API remains unchanged, but the `GuardCondition` class now extends `Element` instead of `Expr`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* The C/C++ "build-mode: none" support is now General Availability (GA).

cpp/ql/lib/experimental/quantum/Language.qll

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ module CryptoInput implements InputSig<Language::Location> {
1414
result = node.asExpr() or
1515
result = node.asParameter() or
1616
result = node.asVariable() or
17-
result = node.asDefiningArgument()
18-
// TODO: do we need asIndirectExpr()?
17+
result = node.asDefiningArgument() or
18+
result = node.asIndirectExpr()
1919
}
2020

2121
string locationToFileBaseNameAndLineNumberString(Location location) {
@@ -53,7 +53,7 @@ module ArtifactFlowConfig implements DataFlow::ConfigSig {
5353
}
5454
}
5555

56-
module ArtifactFlow = DataFlow::Global<ArtifactFlowConfig>;
56+
module ArtifactFlow = TaintTracking::Global<ArtifactFlowConfig>;
5757

5858
/**
5959
* An artifact output to node input configuration
@@ -93,7 +93,13 @@ module GenericDataSourceFlow = TaintTracking::Global<GenericDataSourceFlowConfig
9393

9494
private class ConstantDataSource extends Crypto::GenericConstantSourceInstance instanceof OpenSslGenericSourceCandidateLiteral
9595
{
96-
override DataFlow::Node getOutputNode() { result.asExpr() = this }
96+
override DataFlow::Node getOutputNode() {
97+
// OpenSSL algorithms may be referenced either by string name or by numeric ID:
98+
// String names (e.g. "AES-256-CBC") appear in the AST as character pointer
99+
// literals. For these we must use `asIndirectExpr`. Numeric IDs (e.g. NID_aes_256_cbc)
100+
// appear as integer literals. For these, we must use `asExpr` to get the "value" node.
101+
[result.asIndirectExpr(), result.asExpr()] = this
102+
}
97103

98104
override predicate flowsTo(Crypto::FlowAwareElement other) {
99105
// TODO: separate config to avoid blowing up data-flow analysis
@@ -103,28 +109,4 @@ private class ConstantDataSource extends Crypto::GenericConstantSourceInstance i
103109
override string getAdditionalDescription() { result = this.toString() }
104110
}
105111

106-
module ArtifactUniversalFlowConfig implements DataFlow::ConfigSig {
107-
predicate isSource(DataFlow::Node source) {
108-
source = any(Crypto::ArtifactInstance artifact).getOutputNode()
109-
}
110-
111-
predicate isSink(DataFlow::Node sink) {
112-
sink = any(Crypto::FlowAwareElement other).getInputNode()
113-
}
114-
115-
predicate isBarrierOut(DataFlow::Node node) {
116-
node = any(Crypto::FlowAwareElement element).getInputNode()
117-
}
118-
119-
predicate isBarrierIn(DataFlow::Node node) {
120-
node = any(Crypto::FlowAwareElement element).getOutputNode()
121-
}
122-
123-
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
124-
node1.(AdditionalFlowInputStep).getOutput() = node2
125-
}
126-
}
127-
128-
module ArtifactUniversalFlow = DataFlow::Global<ArtifactUniversalFlowConfig>;
129-
130112
import OpenSSL.OpenSSL

cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/AlgToAVCFlow.qll

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ private import PaddingAlgorithmInstance
1414
*/
1515
module KnownOpenSslAlgorithmToAlgorithmValueConsumerConfig implements DataFlow::ConfigSig {
1616
predicate isSource(DataFlow::Node source) {
17-
source.asExpr() instanceof KnownOpenSslAlgorithmExpr and
17+
(
18+
source.asExpr() instanceof KnownOpenSslAlgorithmExpr or
19+
source.asIndirectExpr() instanceof KnownOpenSslAlgorithmExpr
20+
) and
1821
// No need to flow direct operations to AVCs
19-
not source.asExpr() instanceof OpenSslDirectAlgorithmOperationCall
22+
not source.asExpr() instanceof OpenSslDirectAlgorithmOperationCall and
23+
not source.asIndirectExpr() instanceof OpenSslDirectAlgorithmOperationCall
2024
}
2125

2226
predicate isSink(DataFlow::Node sink) {
@@ -46,10 +50,12 @@ module KnownOpenSslAlgorithmToAlgorithmValueConsumerConfig implements DataFlow::
4650
}
4751

4852
module KnownOpenSslAlgorithmToAlgorithmValueConsumerFlow =
49-
DataFlow::Global<KnownOpenSslAlgorithmToAlgorithmValueConsumerConfig>;
53+
TaintTracking::Global<KnownOpenSslAlgorithmToAlgorithmValueConsumerConfig>;
5054

5155
module RsaPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig implements DataFlow::ConfigSig {
52-
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof OpenSslPaddingLiteral }
56+
predicate isSource(DataFlow::Node source) {
57+
source.asExpr() instanceof OpenSslSpecialPaddingLiteral
58+
}
5359

5460
predicate isSink(DataFlow::Node sink) {
5561
exists(PaddingAlgorithmValueConsumer c | c.getInputNode() = sink)
@@ -61,7 +67,7 @@ module RsaPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig implements DataF
6167
}
6268

6369
module RsaPaddingAlgorithmToPaddingAlgorithmValueConsumerFlow =
64-
DataFlow::Global<RsaPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig>;
70+
TaintTracking::Global<RsaPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig>;
6571

6672
class OpenSslAlgorithmAdditionalFlowStep extends AdditionalFlowInputStep {
6773
OpenSslAlgorithmAdditionalFlowStep() { exists(AlgorithmPassthroughCall c | c.getInNode() = this) }

cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/BlockAlgorithmInstance.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ class KnownOpenSslBlockModeConstantAlgorithmInstance extends OpenSslAlgorithmIns
5353
// Sink is an argument to a CipherGetterCall
5454
sink = getterCall.getInputNode() and
5555
// Source is `this`
56-
src.asExpr() = this and
56+
// NOTE: src literals can be ints or strings, so need to consider asExpr and asIndirectExpr
57+
this = [src.asExpr(), src.asIndirectExpr()] and
5758
// This traces to a getter
5859
KnownOpenSslAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
5960
)

cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/CipherAlgorithmInstance.qll

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import cpp
22
private import experimental.quantum.Language
33
private import KnownAlgorithmConstants
44
private import Crypto::KeyOpAlg as KeyOpAlg
5-
private import OpenSSLAlgorithmInstanceBase
6-
private import PaddingAlgorithmInstance
7-
private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumerBase
8-
private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.DirectAlgorithmValueConsumer
5+
private import experimental.quantum.OpenSSL.Operations.OpenSSLOperationBase
6+
private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
7+
private import OpenSSLAlgorithmInstances
98
private import AlgToAVCFlow
10-
private import BlockAlgorithmInstance
119

1210
/**
1311
* Given a `KnownOpenSslCipherAlgorithmExpr`, converts this to a cipher family type.
@@ -79,7 +77,8 @@ class KnownOpenSslCipherConstantAlgorithmInstance extends OpenSslAlgorithmInstan
7977
// Sink is an argument to a CipherGetterCall
8078
sink = getterCall.getInputNode() and
8179
// Source is `this`
82-
src.asExpr() = this and
80+
// NOTE: src literals can be ints or strings, so need to consider asExpr and asIndirectExpr
81+
this = [src.asExpr(), src.asIndirectExpr()] and
8382
// This traces to a getter
8483
KnownOpenSslAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
8584
)
@@ -97,10 +96,13 @@ class KnownOpenSslCipherConstantAlgorithmInstance extends OpenSslAlgorithmInstan
9796
}
9897

9998
override Crypto::PaddingAlgorithmInstance getPaddingAlgorithm() {
100-
//TODO: the padding is either self, or it flows through getter ctx to a set padding call
101-
// like EVP_PKEY_CTX_set_rsa_padding
10299
result = this
103-
// TODO or trace through getter ctx to set padding
100+
or
101+
exists(OperationStep s |
102+
this.getAvc().(AvcContextCreationStep).flowsToOperationStep(s) and
103+
s.getAlgorithmValueConsumerForInput(PaddingAlgorithmIO()) =
104+
result.(OpenSslAlgorithmInstance).getAvc()
105+
)
104106
}
105107

106108
override string getRawAlgorithmName() {
@@ -117,7 +119,7 @@ class KnownOpenSslCipherConstantAlgorithmInstance extends OpenSslAlgorithmInstan
117119
knownOpenSslConstantToCipherFamilyType(this, result)
118120
or
119121
not knownOpenSslConstantToCipherFamilyType(this, _) and
120-
result = Crypto::KeyOpAlg::TUnknownKeyOperationAlgorithmType()
122+
result = Crypto::KeyOpAlg::TOtherKeyOperationAlgorithmType()
121123
}
122124

123125
override OpenSslAlgorithmValueConsumer getAvc() { result = getterCall }

0 commit comments

Comments
 (0)