CodeQL 2.20.2 (2025-01-22)¶
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, relevant GitHub Changelog updates, changes in the CodeQL extension for Visual Studio Code, and the CodeQL Action changelog.
Security Coverage¶
CodeQL 2.20.2 runs a total of 454 security queries when configured with the Default suite (covering 168 CWE). The Extended suite enables an additional 128 queries (covering 34 more CWE).
CodeQL CLI¶
Bug Fixes¶
Fixed a bug where CodeQL would crash on rare occasions while merging SARIF files before uploading results.
Improvements¶
codeql database createandcodeql database finalizenow write relations to disk in a new, compressed format. As a result, databases will generally take up less space on disk, whether zipped or unzipped. Note that databases in this format can only be read and analyzed using CodeQL version 2.20.1 onwards. Attempting to analyze such a database with CodeQL version 2.20.0 or older will fail, with an error message like the following:UnsortedExtensionalError: Tuples that were assumed to be in order are not: [123456777, 777654321, 123456777]<[777654321, 123456777, 777654321]
Added the
.bitLength()method toQlBuiltins::BigInt.
Query Packs¶
Bug Fixes¶
Java/Kotlin¶
Classes that define a
writeReplacemethod are no longer flagged by thejava/missing-no-arg-constructor-on-serializablequery on the assumption they are unlikely to be deserialized using the default algorithm.The query “Use of a broken or risky cryptographic algorithm” (
java/weak-cryptographic-algorithm) now gives the reason why the cryptographic algorithm is considered weak.
JavaScript/TypeScript¶
Fixed a TypeScript extractor crash that would occur when encountering an export specifier whose local specifier was a string literal.
Major Analysis Improvements¶
JavaScript/TypeScript¶
The
js/xss-through-domquery now recognises sources of DOM input originating from Angular templates.
Minor Analysis Improvements¶
C/C++¶
Added dataflow models for
SysAllocStringand related functions.The
cpp/badly-bounded-write,cpp/equality-on-floats,cpp/short-global-name,cpp/static-buffer-overflow,cpp/too-few-arguments,cpp/useless-expression,cpp/world-writable-file-creationqueries no longer produce alerts on files created by CMake to test the build configuration.
Language Libraries¶
Major Analysis Improvements¶
JavaScript/TypeScript¶
All data flow queries are now using the same underlying data flow library as the other languages analyses, replacing the old one written specifically for JavaScript/TypeScript. This is a significant change and users may consequently observe differences in the alerts generated by the analysis.
Minor Analysis Improvements¶
C/C++¶
DefaultOptions::exitsnow holds for C23 functions with the_Noreturnor___Noreturn__attribute.
C#¶
Added extractor support for extracting implicit
ToStringcalls in binary+expressions and string interpolation expressions.The Razor source generator invocation in
build-mode:noneextraction has been changed to use relative file paths instead of absolute ones.C# 13: Added extractor support and call dispatch logic (data flow) for the (negative) type parameter constraint
allows ref struct. Added extractor support for the type parameter constraintnotnull.
Golang¶
databaselocal source models have been added for the Beego ORM package.databaselocal source models have been added for thegithub.com/jmoiron/sqlxpackage.Added
databasesource models for database methods from thegorm.io/gormpackage.databaselocal source models have been added for thedatabase/sqlanddatabase/sql/driverpackages.
Java/Kotlin¶
JavacTool-based compiler interception no longer requires an--add-opensdirective whenFileObject.toUriis accessible.JavacTool-based compiler interception no longer throws an exception visible to the program usingJavacToolon failure to extract a file path from a passedJavaFileObject.JavacTool-based compiler interception now supports files that don’t simply wrap afile://URL, such as a source file inside a JAR, or an in-memory file, but which do implementgetCharContent.
JavaScript/TypeScript¶
The sensitive data library has been improved so that
snake_casestyle variable names are recognized more reliably. This may result in more sensitive data being identified, and more results from queries that use the sensitive data library.
Python¶
The sensitive data library has been improved so that
snake_casestyle variable names are recognized more reliably. This may result in more sensitive data being identified, and more results from queries that use the sensitive data library.Additional taint steps through methods of
lxml.etree.Elementandlxml.etree.ElementTreeobjects from thelxmlPyPI package have been modeled.
Ruby¶
The sensitive data library has been improved so that
snake_casestyle variable names are recognized more reliably. This may result in more sensitive data being identified, and more results from queries that use the sensitive data library.Types are now being tracked in data flow, but only when the type of an object is obvious from the context. For example,
C.newhas guaranteed typeC, while indef add(x, y) { x + y }we cannot assign a type tox + y(it could, for instance, be bothStringandInteger). Tracking types allows us to remove false-positive results when type incompatibility can be established.
Swift¶
The sensitive data library has been improved so that
snake_casestyle variable names are recognized more reliably. This may result in more sensitive data being identified, and more results from queries that use the sensitive data library.
Deprecated APIs¶
JavaScript/TypeScript¶
Custom data flow queries will need to be migrated in order to use the shared data flow library. Until migrated, such queries will compile with deprecation warnings and run with a deprecated copy of the old data flow library. The deprecation layer will be removed in early 2026, after which any unmigrated queries will stop working. See more information in the migration guide.
New Features¶
C/C++¶
Add a new predicate
getAnIndirectBarrierto the parameterized moduleInstructionBarrierGuardinsemmle.code.cpp.dataflow.new.DataFlowfor computing indirect dataflow nodes that are guarded by a given instruction. This predicate is similar to thegetAnIndirectBarrierpredicate on the parameterized moduleBarrierGuard.A new predicate
getDecltypewas added to theProxyClassclass, which yields the decltype for the proxy class.Template classes that are of
structtype are now also instances of theStructclass.Template classes that are of
uniontype are now also instances of theUnionclass.A new abstract class
ConfigurationTestFile(semmle.code.cpp.ConfigurationTestFile.ConfigurationTestFile) was introduced, which represents files created to test the build configuration. A subclassCmakeTryCompileFileofConfigurationTestFilewas also introduced, which represents files created by CMake to test the build configuration.New predicates
getARequiresClause,getTemplateRequiresClauseandgetFunctionRequiresClausewere added to theFunctionDeclarationEntryclass, which yield the requires clauses when the entry represents a function template declaration with requires clauses.A new predicate
getRequiresClausewas added to theTypeDeclarationEntryclass, which yields the requires clause when the entry represents a class template declaration with a requires clause.A new predicate
getRequiresClausewas added to theVariableDeclarationEntryclass, which yields the requires clause when the entry represents a variable template declaration with a requires clause.A new predicate
getTypeConstraintwas added to theTypeTemplateParameterclass, which yields the type constraint of the parameter if it exists.A new class
VariableTemplateSpecializationwas introduced, which represents explicit specializations of variable templates.A new predicate
isSpecializationwas added to theVariableclass, which holds if the variable is a template specialization.A new class
ConceptIdExprwas introduced, which represents C++20 concept id expressions.A new class
Conceptwas introduced, which represents C++20 concepts.The
getTemplateArgumentTypeandgetTemplateArgumentValuepredicates of theDeclarationclass now also yield template arguments of concepts.A new class
ConstevalIfStmtwas introduced, which represents the C++23if constevalandif ! constevalstatements.
Java/Kotlin¶
The Java and Kotlin extractors now support
CODEQL_PATH_TRANSFORMER.SEMMLE_PATH_TRANSFORMERis still supported, but deprecated.