CodeQL 2.18.0 (2024-07-11)¶
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.18.0 runs a total of 415 security queries when configured with the Default suite (covering 161 CWE). The Extended suite enables an additional 131 queries (covering 35 more CWE). 1 security query has been added with this release.
CodeQL CLI¶
Breaking Changes¶
A number of breaking changes have been made to the C and C++ CodeQL test environment as used by
codeql test run:The test environment no longer defines any GNU-specific builtin macros. If these macros are still needed by a test, please define them via
semmle-extractor-options.The
--force-recomputeoption is no longer directly supported bysemmle-extractor-options. Instead,--edg --force-recomputeshould be specified.The
--gnu_versionand--microsoft_versionoptions that can be specified viasemmle-extractor-optionsare now synonyms, and only one should be specified as part ofsemmle-extractor-options. Furthermore, is also no longer possible to specify these options via the following syntax.--edg --gnu_version --edg <version number>, and--edg --microsoft_version --edg <version number>
The shorter
--gnu_version <version number>and--microsoft_version <version number>should be used.
The
--build_error_dirand--predefined_macroscommand line options have been removed from the C/C++ extractor. It has never been possible to pass these options through the CLI, but some customers with advanced setups may have been passing them through internal undocumented interfaces. Passing the option--build_error_dirdid not have any effect, and it is safe to remove the option. The--predefined_macrosoption should have been unnecessary, as long as the extractor was invoked with the--mimicoption.
Bug Fixes¶
Where a MacOS unsigned binary cannot be signed, CodeQL will now continue trying to trace compiler invocations created by that process and its children. In particular this means that Bazel builds on MacOS are now traceable.
Fixed a bug where test discovery would fail if there is a syntax error in a qlpack file. Now, a warning message will be printed and discovery will continue.
Improvements¶
Introduced the
--include-logsoption to thecodeql database bundlecommand. This new feature allows users to include logs in the generated database bundle, allowing for a more complete treatment of the bundle, and bringing the tool capabilities up-to-speed with the documentation.codeql database initandcodeql database createnow support the--force-overwriteoption. When this option is specified, the command will delete the specified database directory even if it does not look like a database directory. This option is only recommended for automation. For directcommand line commands, it is recommended to use the--overwriteoption, which includes extra protection and will refuse to delete a directory that does not look like a database directory.Extract
.xsaccess,*.xsjsand*.xsjslibfiles for SAP HANA XS as Javascript.We have updated many compiler error messages and warnings to improve their readability and standardize their grammar. Where necessary, please use the
--learnoption for thecodeql test runcommand.
Known Issues¶
Compilation of QL queries is about 30% slower than in previous releases. This only affects users who write custom queries, and only at compilation time, not at run time. This regression will be fixed in the upcoming 2.18.1 release.
Query Packs¶
Major Analysis Improvements¶
Java/Kotlin¶
The query
java/weak-cryptographic-algorithmno longer alerts aboutRSA/ECBalgorithm strings.
Minor Analysis Improvements¶
Java/Kotlin¶
The query
java/tainted-permissions-checknow uses threat models. This means thatlocalsources are no longer included by default for this query, but can be added by enabling thelocalthreat model.Added more
org.apache.commons.io.FileUtils-related sinks to the path injection query.
JavaScript/TypeScript¶
Added a new experimental query,
js/cors-misconfiguration, which detects misconfigured CORS HTTP headers in thecorsandapollolibraries.
Python¶
Adding Python support for Hardcoded Credentials as Models as Data
Additional sanitizers have been added to the
py/full-ssrfandpy/partial-ssrfqueries for methods that verify a string contains only a certain set of characters, such as.isalnum()as well as regular expression tests.
Language Libraries¶
Bug Fixes¶
Golang¶
Fixed dataflow via global variables other than via a direct write: for example, via a side-effect on a global, such as
io.copy(SomeGlobal, ...)or via assignment to a field or array or slice cell of a global. This means that any data-flow query may return more results where global variables are involved.
Java/Kotlin¶
Support for
codeql test runfor Kotlin sources has been fixed.
Major Analysis Improvements¶
JavaScript/TypeScript¶
Added support for TypeScript 5.5.
Minor Analysis Improvements¶
C/C++¶
The queries “Potential double free” (
cpp/double-free) and “Potential use after free” (cpp/use-after-free) now produce fewer false positives.The “Guards” library (
semmle.code.cpp.controlflow.Guards) now also infers guards from calls to the builtin operation__builtin_expect. As a result, some queries may produce fewer false positives.
Golang¶
DataFlow queries which previously used
RemoteFlowSourceto define their sources have been modified to instead useThreatModelFlowSource. This means these queries will now respect threat model configurations. The default threat model configuration is equivalent toRemoteFlowSource, so there should be no change in results for users using the default.Added the
ThreatModelFlowSourceclass toFlowSources.qll. TheThreatModelFlowSourceclass can be used to include sources which match the current threat model configuration. This is the first step in supporting threat modeling for Go.
Java/Kotlin¶
Added models for the following packages:
io.undertow.server.handlers.resource
jakarta.faces.context
javax.faces.context
javax.servlet
org.jboss.vfs
org.springframework.core.io
A bug has been fixed in the heuristic identification of uncertain control flow, which is used to filter data flow in order to improve performance and reduce false positives. This fix means that slightly more code is identified and hence pruned from data flow.
Excluded reverse DNS from the loopback address as a source of untrusted data.
JavaScript/TypeScript¶
Enabled type-tracking to follow content through array methods
Improved modeling of
Array.prototype.splicefor when it is called with more than two arguments
Python¶
A number of Python queries now support sinks defined using data extensions. The format of data extensions for Python has been documented.
Ruby¶
Element references with blocks, such as
foo[:bar] { |x| puts x}, are now parsed correctly.The
CleartextSources.qlllibrary, used byrb/clear-text-logging-sensitive-dataandrb/clear-text-logging-sensitive-data, has been updated to consider heuristics for additional categories of sensitive data.
New Features¶
C/C++¶
The syntax for models-as-data rows has been extended to make it easier to select sources, sinks, and summaries that involve templated functions and classes. Additionally, the syntax has also been extended to make it easier to specify models with arbitrary levels of indirection. See
dataflow/ExternalFlow.qllfor the updated documentation and specification for the model format.It is now possible to extend the classes
AllocationFunctionandDeallocationFunctionvia data extensions. Extensions of these classes should be added to thelib/ext/allocationandlib/ext/deallocationdirectories respectively.