Skip to content

Commit 0524ea6

Browse files
authored
Merge branch 'main' into openssl-signatures
2 parents f64a8c9 + 0ef17ba commit 0524ea6

File tree

8 files changed

+247
-19
lines changed

8 files changed

+247
-19
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* Added a predicate `getReferencedMember` to `UsingDeclarationEntry`, which yields a member depending on a type template parameter.

cpp/ql/lib/experimental/quantum/OpenSSL/Operations/EVPHashOperation.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private import EVPHashInitializer
99
private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
1010

1111
class EVP_Digest_Update_Call extends EVPUpdate {
12-
EVP_Digest_Update_Call() { this.(Call).getTarget().getName() in ["EVP_DigestUpdate"] }
12+
EVP_Digest_Update_Call() { this.(Call).getTarget().getName() = "EVP_DigestUpdate" }
1313

1414
override Expr getInputArg() { result = this.(Call).getArgument(1) }
1515
}

cpp/ql/lib/experimental/quantum/OpenSSL/Operations/OpenSSLOperationBase.qll

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgor
77
*/
88
class OpenSSLCall extends Call { }
99

10-
/**
11-
* All OpenSSL operations.
10+
* A class for all OpenSSL operations.
1211
*/
13-
abstract class OpenSSLOperation extends Crypto::OperationInstance instanceof OpenSSLCall {
12+
abstract class OpenSSLOperation extends Crypto::OperationInstance instanceof Call {
1413
/**
1514
* Expression that specifies the algorithm for the operation.
16-
* Will be an argument of the operation in the simplest case
17-
* and EVPPKeyAlgorithmConsumer's valueArgExpr in more complex cases.
15+
* Will be an argument of the operation in the simplest case.
1816
*/
1917
abstract Expr getAlgorithmArg();
2018

@@ -37,12 +35,12 @@ abstract class OpenSSLOperation extends Crypto::OperationInstance instanceof Ope
3735
*/
3836
abstract class EVPInitialize extends OpenSSLCall {
3937
/**
40-
* The context argument that ties together initialization, updates and/or final calls.
38+
* Gets the context argument that ties together initialization, updates and/or final calls.
4139
*/
4240
Expr getContextArg() { result = this.(Call).getArgument(0) }
4341

4442
/**
45-
* The type of key operation, none if not applicable.
43+
* Gets the type of key operation, none if not applicable.
4644
*/
4745
Crypto::KeyOperationSubtype getKeyOperationSubtype() { none() }
4846

@@ -54,12 +52,12 @@ abstract class EVPInitialize extends OpenSSLCall {
5452
Expr getAlgorithmArg() { none() }
5553

5654
/**
57-
* The key for the operation, none if not applicable.
55+
* Gets the key for the operation, none if not applicable.
5856
*/
5957
Expr getKeyArg() { none() }
6058

6159
/**
62-
* The IV/nonce, none if not applicable.
60+
* Gets the IV/nonce, none if not applicable.
6361
*/
6462
Expr getIVArg() { none() }
6563
}
@@ -69,9 +67,10 @@ abstract class EVPInitialize extends OpenSSLCall {
6967
* These are not operations in the sense of Crypto::OperationInstance,
7068
* but they are used to update the context for the operation.
7169
*/
70+
7271
abstract class EVPUpdate extends OpenSSLCall {
7372
/**
74-
* The context argument that ties together initialization, updates and/or final calls.
73+
* Gets the context argument that ties together initialization, updates and/or final calls.
7574
*/
7675
Expr getContextArg() { result = this.(Call).getArgument(0) }
7776

@@ -108,7 +107,7 @@ private module AlgGetterToAlgConsumerFlow = DataFlow::Global<AlgGetterToAlgConsu
108107
*/
109108
abstract class EVPOperation extends OpenSSLOperation {
110109
/**
111-
* The context argument that ties together initialization, updates and/or final calls.
110+
* Gets the context argument that ties together initialization, updates and/or final calls.
112111
*/
113112
Expr getContextArg() { result = this.(Call).getArgument(0) }
114113

@@ -126,17 +125,15 @@ abstract class EVPOperation extends OpenSSLOperation {
126125
/**
127126
* Overwrite with an explicitly specified algorithm or leave base implementation to find it in the initialization call.
128127
*/
129-
override Expr getAlgorithmArg() {
130-
if exists(this.getInitCall()) then result = this.getInitCall().getAlgorithmArg() else none()
131-
}
128+
override Expr getAlgorithmArg() { result = this.getInitCall().getAlgorithmArg() }
132129

133130
/**
134131
* Finds the initialization call, may be none.
135132
*/
136133
EVPInitialize getInitCall() {
137134
CTXFlow::ctxArgFlowsToCtxArg(result.getContextArg(), this.getContextArg())
138135
}
139-
136+
140137
Crypto::ArtifactOutputDataFlowNode getOutputArtifact() {
141138
result = DataFlow::exprNode(this.getOutputArg())
142139
}
@@ -165,14 +162,15 @@ abstract class EVPFinal extends EVPOperation {
165162
}
166163

167164
/**
168-
* The input data was provided to all update calls.
165+
* Gets the input data was provided to all update calls.
169166
* If more input data was provided in the final call, override the method.
170167
*/
171168
override Expr getInputArg() { result = this.getUpdateCalls().getInputArg() }
172169

173170
/**
174-
* The output data was provided to all update calls.
171+
* Gets the output data was provided to all update calls.
175172
* If more output data was provided in the final call, override the method.
176173
*/
177174
override Expr getOutputArg() { result = this.getUpdateCalls().getOutputArg() }
178175
}
176+

cpp/ql/lib/semmle/code/cpp/Namespace.qll

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,27 @@ class UsingDeclarationEntry extends UsingEntry {
174174
*/
175175
Declaration getDeclaration() { usings(underlyingElement(this), unresolveElement(result), _, _) }
176176

177-
override string toString() { result = "using " + this.getDeclaration().getDescription() }
177+
/**
178+
* Gets the member that is referenced by this using declaration, where the member depends on a
179+
* type template parameter.
180+
*
181+
* For example:
182+
* ```
183+
* template <typename T>
184+
* class A {
185+
* using T::m;
186+
* };
187+
* ```
188+
* Here, `getReferencedMember()` yields the member `m` of `T`. Observe that,
189+
* as `T` is not instantiated, `m` is represented by a `Literal` and not
190+
* a `Declaration`.
191+
*/
192+
Literal getReferencedMember() { usings(underlyingElement(this), unresolveElement(result), _, _) }
193+
194+
override string toString() {
195+
result = "using " + this.getDeclaration().getDescription() or
196+
result = "using " + this.getReferencedMember()
197+
}
178198
}
179199

180200
/**

cpp/ql/test/library-tests/comments/binding/commentBinding.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
| multi.c:5:27:5:36 | // Multi 3 | declaration of multi3 |
1010
| templates.cpp:3:3:3:8 | // Foo | declaration of foo |
1111
| templates.cpp:7:3:7:8 | // Bar | definition of bar |
12+
| templates.cpp:16:3:16:20 | // using T::member | using member |
13+
| templates.cpp:19:3:19:28 | // using T::nested::member | using member |
14+
| templates.cpp:25:3:25:20 | // using T::member | using member |

cpp/ql/test/library-tests/comments/binding/templates.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ class Cl {
1010
}
1111
};
1212

13+
14+
template <typename T>
15+
class Derived : public T {
16+
// using T::member
17+
using T::member;
18+
19+
// using T::nested::member
20+
using T::nested::member;
21+
};
22+
23+
template <typename T>
24+
class Base {
25+
// using T::member
26+
using T::member;
27+
};
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
.. _codeql-cli-2.21.4:
2+
3+
==========================
4+
CodeQL 2.21.4 (2025-06-02)
5+
==========================
6+
7+
.. contents:: Contents
8+
:depth: 2
9+
:local:
10+
:backlinks: none
11+
12+
This is an overview of changes in the CodeQL CLI and relevant CodeQL query and library packs. For additional updates on changes to the CodeQL code scanning experience, check out the `code scanning section on the GitHub blog <https://github.blog/tag/code-scanning/>`__, `relevant GitHub Changelog updates <https://github.blog/changelog/label/code-scanning/>`__, `changes in the CodeQL extension for Visual Studio Code <https://marketplace.visualstudio.com/items/GitHub.vscode-codeql/changelog>`__, and the `CodeQL Action changelog <https://github.com/github/codeql-action/blob/main/CHANGELOG.md>`__.
13+
14+
Security Coverage
15+
-----------------
16+
17+
CodeQL 2.21.4 runs a total of 449 security queries when configured with the Default suite (covering 165 CWE). The Extended suite enables an additional 128 queries (covering 33 more CWE).
18+
19+
CodeQL CLI
20+
----------
21+
22+
Deprecations
23+
~~~~~~~~~~~~
24+
25+
* The :code:`clang_vector_types`, :code:`clang_attributes`, and :code:`flax-vector-conversions` command line options have been removed from the C/C++ extractor. These options were introduced as workarounds to frontend limitations in earlier versions of the extractor and are no longer needed when calling the extractor directly.
26+
27+
Miscellaneous
28+
~~~~~~~~~~~~~
29+
30+
* The build of Eclipse Temurin OpenJDK that is used to run the CodeQL CLI has been updated to version 21.0.7.
31+
32+
Query Packs
33+
-----------
34+
35+
Minor Analysis Improvements
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
38+
C/C++
39+
"""""
40+
41+
* Added flow model for the :code:`SQLite` and :code:`OpenSSL` libraries. This may result in more alerts when running queries on codebases that use these libraries.
42+
43+
C#
44+
""
45+
46+
* The precision of the query :code:`cs/missed-readonly-modifier` has been improved. Some false positives related to static fields and struct type fields have been removed.
47+
* The queries :code:`cs/password-in-configuration`, :code:`cs/hardcoded-credentials` and :code:`cs/hardcoded-connection-string-credentials` have been removed from all query suites.
48+
* The precision of the query :code:`cs/gethashcode-is-not-defined` has been improved (false negative reduction). Calls to more methods (and indexers) that rely on the invariant :code:`e1.Equals(e2)` implies :code:`e1.GetHashCode() == e2.GetHashCode()` are taken into account.
49+
* The precision of the query :code:`cs/uncontrolled-format-string` has been improved (false negative reduction). Calls to :code:`System.Text.CompositeFormat.Parse` are now considered a format like method call.
50+
51+
Golang
52+
""""""
53+
54+
* The query :code:`go/hardcoded-credentials` has been removed from all query suites.
55+
56+
Java/Kotlin
57+
"""""""""""
58+
59+
* The query :code:`java/hardcoded-credential-api-call` has been removed from all query suites.
60+
61+
JavaScript/TypeScript
62+
"""""""""""""""""""""
63+
64+
* The queries :code:`js/hardcoded-credentials` and :code:`js/password-in-configuration-file` have been removed from all query suites.
65+
66+
Python
67+
""""""
68+
69+
* The query :code:`py/hardcoded-credentials` has been removed from all query suites.
70+
71+
Ruby
72+
""""
73+
74+
* The query :code:`rb/hardcoded-credentials` has been removed from all query suites.
75+
76+
Swift
77+
"""""
78+
79+
* The queries :code:`swift/hardcoded-key` and :code:`swift/constant-password` have been removed from all query suites.
80+
81+
GitHub Actions
82+
""""""""""""""
83+
84+
* The query :code:`actions/missing-workflow-permissions` is now aware of the minimal permissions needed for the actions :code:`deploy-pages`, :code:`delete-package-versions`, :code:`ai-inference`. This should lead to better alert messages and better fix suggestions.
85+
86+
Language Libraries
87+
------------------
88+
89+
Bug Fixes
90+
~~~~~~~~~
91+
92+
C/C++
93+
"""""
94+
95+
* Fixed a problem where :code:`asExpr()` on :code:`DataFlow::Node` would never return :code:`ArrayAggregateLiteral`\ s.
96+
* Fixed a problem where :code:`asExpr()` on :code:`DataFlow::Node` would never return :code:`ClassAggregateLiteral`\ s.
97+
98+
Ruby
99+
""""
100+
101+
* Bug Fixes
102+
* The Ruby printAst.qll library now orders AST nodes slightly differently: child nodes that do not literally appear in the source code, but whose parent nodes do, are assigned a deterministic order based on a combination of source location and logical order within the parent. This fixes the non-deterministic ordering that sometimes occurred depending on evaluation order. The effect may also be visible in downstream uses of the printAst library, such as the AST view in the VSCode extension.
103+
104+
Breaking Changes
105+
~~~~~~~~~~~~~~~~
106+
107+
C/C++
108+
"""""
109+
110+
* Deleted the deprecated :code:`userInputArgument` predicate and its convenience accessor from the :code:`Security.qll`.
111+
* Deleted the deprecated :code:`userInputReturned` predicate and its convenience accessor from the :code:`Security.qll`.
112+
* Deleted the deprecated :code:`userInputReturn` predicate from the :code:`Security.qll`.
113+
* Deleted the deprecated :code:`isUserInput` predicate and its convenience accessor from the :code:`Security.qll`.
114+
* Deleted the deprecated :code:`userInputArgument` predicate from the :code:`SecurityOptions.qll`.
115+
* Deleted the deprecated :code:`userInputReturned` predicate from the :code:`SecurityOptions.qll`.
116+
117+
Swift
118+
"""""
119+
120+
* Deleted the deprecated :code:`parseContent` predicate from the :code:`ExternalFlow.qll`.
121+
* Deleted the deprecated :code:`hasLocationInfo` predicate from the :code:`DataFlowPublic.qll`.
122+
* Deleted the deprecated :code:`SummaryComponent` class from the :code:`FlowSummary.qll`.
123+
* Deleted the deprecated :code:`SummaryComponentStack` class from the :code:`FlowSummary.qll`.
124+
* Deleted the deprecated :code:`SummaryComponent` module from the :code:`FlowSummary.qll`.
125+
* Deleted the deprecated :code:`SummaryComponentStack` module from the :code:`FlowSummary.qll`.
126+
* Deleted the deprecated :code:`RequiredSummaryComponentStack` class from the :code:`FlowSummary.qll`.
127+
128+
Minor Analysis Improvements
129+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
131+
C#
132+
""
133+
134+
* The generated Models as Data (MaD) models for .NET 9 Runtime have been updated and are now more precise (due to a recent model generator improvement).
135+
136+
JavaScript/TypeScript
137+
"""""""""""""""""""""
138+
139+
* Improved analysis for :code:`ES6 classes` mixed with :code:`function prototypes`, leading to more accurate call graph resolution.
140+
141+
Python
142+
""""""
143+
144+
* The Python extractor now extracts files in hidden directories by default. If you would like to skip files in hidden directories, add :code:`paths-ignore: ["**/.*/**"]` to your `Code Scanning config <https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#specifying-directories-to-scan>`__. If you would like to skip all hidden files, you can use :code:`paths-ignore: ["**/.*"]`. When using the CodeQL CLI for extraction, specify the configuration (creating the configuration file if necessary) using the :code:`--codescanning-config` option.
145+
146+
Ruby
147+
""""
148+
149+
* Captured variables are currently considered live when the capturing function exits normally. Now they are also considered live when the capturing function exits via an exception.
150+
151+
Swift
152+
"""""
153+
154+
* Updated to allow analysis of Swift 6.1.1.
155+
* :code:`TypeValueExpr` experimental AST leaf is now implemented in the control flow library
156+
157+
Deprecated APIs
158+
~~~~~~~~~~~~~~~
159+
160+
Java/Kotlin
161+
"""""""""""
162+
163+
* The predicate :code:`getValue()` on :code:`SpringRequestMappingMethod` is now deprecated. Use :code:`getAValue()` instead.
164+
* Java now uses the shared :code:`BasicBlock` library. This means that the names of several member predicates have been changed to align with the names used in other languages. The old predicates have been deprecated. The :code:`BasicBlock` class itself no longer extends :code:`ControlFlowNode` - the predicate :code:`getFirstNode` can be used to fix any QL code that somehow relied on this.
165+
166+
New Features
167+
~~~~~~~~~~~~
168+
169+
C/C++
170+
"""""
171+
172+
* Added local flow source models for :code:`ReadFile`, :code:`ReadFileEx`, :code:`MapViewOfFile`, :code:`MapViewOfFile2`, :code:`MapViewOfFile3`, :code:`MapViewOfFile3FromApp`, :code:`MapViewOfFileEx`, :code:`MapViewOfFileFromApp`, :code:`MapViewOfFileNuma2`, and :code:`NtReadFile`.
173+
* Added the :code:`pCmdLine` arguments of :code:`WinMain` and :code:`wWinMain` as local flow sources.
174+
* Added source models for :code:`GetCommandLineA`, :code:`GetCommandLineW`, :code:`GetEnvironmentStringsA`, :code:`GetEnvironmentStringsW`, :code:`GetEnvironmentVariableA`, and :code:`GetEnvironmentVariableW`.
175+
* Added summary models for :code:`CommandLineToArgvA` and :code:`CommandLineToArgvW`.
176+
* Added support for :code:`wmain` as part of the ArgvSource model.
177+
178+
Shared Libraries
179+
----------------
180+
181+
Breaking Changes
182+
~~~~~~~~~~~~~~~~
183+
184+
Static Single Assignment (SSA)
185+
""""""""""""""""""""""""""""""
186+
187+
* Adjusted the Guards interface in the SSA data flow integration to distinguish :code:`hasBranchEdge` from :code:`controlsBranchEdge`. Any breakage can be fixed by implementing one with the other as a reasonable fallback solution.

docs/codeql/codeql-overview/codeql-changelog/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A list of queries for each suite and language `is available here <https://docs.g
1111
.. toctree::
1212
:maxdepth: 1
1313

14+
codeql-cli-2.21.4
1415
codeql-cli-2.21.3
1516
codeql-cli-2.21.2
1617
codeql-cli-2.21.1

0 commit comments

Comments
 (0)