CodeQL 2.17.0 (2024-04-04)¶
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.17.0 runs a total of 410 security queries when configured with the Default suite (covering 160 CWE). The Extended suite enables an additional 130 queries (covering 34 more CWE).
CodeQL CLI¶
Deprecations¶
- The
--[no-]analysis-summary-v2
and--[no-]new-analysis-summary
options that were used to enable (or disable) improved summary information printed at the end of acodeql database analyze
invocation are no longer supported. Improved summary information is now enabled for all invocations. - Support for overwriting default CodeQL SARIF run properties using the
--sarif-run-property
command line option has been removed. This removes the ability to overwrite thesemmle.formatSpecifier
,metricResults
, andcodeqlConfigSummary
properties in the SARIF run file.
Improvements¶
- TRAP import (a part of
codeql database create
andcodeql database finalize
) now performs better in low-memory situations. (Put another way, it now needs less RAM to achieve the same performance as before.) - The worst-case performance of transitive closure computation (using the
+
or*
postfix operators or thefastTC
higher-order primitive in QL) has been greatly improved.
Miscellaneous¶
- The build of Eclipse Temurin OpenJDK that is used to run the CodeQL CLI has been updated to version 21.0.2.
Query Packs¶
Major Analysis Improvements¶
C#¶
- The
Stored
variants of some queries (cs/stored-command-line-injection
,cs/web/stored-xss
,cs/stored-ldap-injection
,cs/xml/stored-xpath-injection
,cs/second-order-sql-injection
) have been removed. If you were using these queries, their results can be restored by enabling thefile
anddatabase
threat models in your threat model configuration.
Java/Kotlin¶
- The
java/missing-case-in-switch
query now gives only a single alert for each switch statement, giving some examples of the missing cases as well as a count of how many are missing.
Minor Analysis Improvements¶
C/C++¶
- The “Missing return-value check for a ‘scanf’-like function” query (
cpp/missing-check-scanf
) has been converted to apath-problem
query. - The “Potentially uninitialized local variable” query (
cpp/uninitialized-local
) has been converted to apath-problem
query. - Added models for
GLib
allocation and deallocation functions.
C#¶
- The alert message of
cs/wrong-compareto-signature
has been changed to remove unnecessary element references. - Data flow queries that track flow from local flow sources now use the current threat model configuration instead. This may lead to changes in the produced alerts if the threat model configuration only uses remote flow sources. The changed queries are
cs/code-injection
,cs/resource-injection
,cs/sql-injection
, andcs/uncontrolled-format-string
.
Golang¶
- The query
go/hardcoded-credentials
no longer discards string literals based on “weak password” heuristics. - The query
go/sql-injection
now recognizes more sinks in the packagegithub.com/Masterminds/squirrel
.
Java/Kotlin¶
- Variables named
tokenImage
are no longer sources for thejava/sensitive-log
query. This is because this variable name is used in parsing code generated by JavaCC, so it causes a large number of false positive alerts. - Added sanitizers for relative URLs,
List.contains()
, and checking the host of a URI to thejava/ssrf
andjava/unvalidated-url-redirection
queries.
JavaScript/TypeScript¶
- The call graph has been improved, leading to more alerts for data flow based queries.
New Queries¶
C/C++¶
- Added a new query,
cpp/type-confusion
, to detect casts to invalid types.
Golang¶
- The query “Slice memory allocation with excessive size value” (
go/uncontrolled-allocation-size
) has been promoted from experimental to the main query pack. Its results will now appear by default. This query was originally submitted as an experimental query by @Malayke.
Java/Kotlin¶
- The query
java/unsafe-url-forward-dispatch-load
has been promoted from experimental to the main query pack asjava/unvalidated-url-forward
. Its results will now appear by default. This query was originally submitted as an experimental query by @haby0 and by @luchua-bc.
Query Metadata Changes¶
C/C++¶
@precision medium
metadata was added to thecpp/boost/tls-settings-misconfiguration
andcpp/boost/use-of-deprecated-hardcoded-security-protocol
queries, and these queries are now included in the security-extended suite. The@name
metadata of these queries were also updated.
JavaScript/TypeScript¶
- The
@precision
of thejs/unsafe-external-link
has been reduced tolow
to reflect the fact that modern browsers do not expose the opening window for such links. This mitigates the potential security risk of having a link withtarget="_blank"
.
Language Libraries¶
Breaking Changes¶
C#¶
- The CIL extractor has been deleted and the corresponding extractor option
cil
has been removed. It is no longer possible to do CIL extraction. - The QL library C# classes no longer extend their corresponding
DotNet
classes. Furthermore, CIL related data flow functionality has been deleted and allDotNet
andCIL
related classes have been deprecated. This effectively means that it no longer has any effect to enable CIL extraction.
Java/Kotlin¶
- The Java extractor no longer supports the
ODASA_SNAPSHOT
legacy environment variable.
Major Analysis Improvements¶
JavaScript/TypeScript¶
- Added support for TypeScript 5.4.
Swift¶
- Upgraded to Swift 5.10
- New AST node is extracted:
ThenStmt
Minor Analysis Improvements¶
C/C++¶
- Added destructors for temporary objects with extended lifetimes to the intermediate representation.
C#¶
- Added new source models for the
Dapper
package. These models can be enabled by enabling thedatabase
threat model. - Additional models have been added for
System.IO
. These are primarily source models with thefile
threat model, and summaries related to reading from a file or stream. - Support for C# 12 / .NET8.
- Added the
windows-registry
source kind and threat model to represent values which come from the registry on Windows. - The models for
System.Net.Http.HttpRequestMessage
have been modified to better model the flow of tainted URIs. - The .NET standard libraries APIs for accessing command line arguments and environment variables have been modeled using the
commandargs
andenvironment
threat models. - The
cs/assembly-path-injection
query has been modified so that it’s sources rely onThreatModelFlowSource
. In order to restore results from command line arguments, you should enable thecommandargs
threat model. - The models for
System.IO.TextReader
have been modified to better model the flow of tainted text from aTextReader
.
Golang¶
- The
CODEQL_EXTRACTOR_GO_FAST_PACKAGE_INFO
option, which speeds up retrieval of dependency information, is now on by default. This was originally an external contribution by @xhd2015. - Added dataflow sources for the package
gopkg.in/macaron.v1
.
Java/Kotlin¶
- Increased the precision of some dataflow models of the class
java.net.URL
by distinguishing the parts of a URL. - The Java extractor and QL libraries now support Java 22, including support for anonymous variables, lambda parameters and patterns.
- Pattern cases with multiple patterns and that fall through to or from other pattern cases are now supported. The
PatternCase
class gains the newgetPatternAtIndex
andgetAPattern
predicates, and deprecatesgetPattern
. - Added a
path-injection
sink for theopen
methods of theandroid.os.ParcelFileDescriptor
class.
Ruby¶
- Data flow is now tracked through
ActiveRecord
scopes. - Modeled instances of
ActionDispatch::Http::UploadedFile
that can be obtained from element reads ofActionController::Parameters
, with calls tooriginal_filename
,content_type
, andread
now propagating taint from their receiver. - The second argument,
subquery_name
, of theActiveRecord::QueryMethods::from
method, is now recognized as an sql injection sink. - Calls to
Typhoeus::Request.new
are now considered as instances of theHttp::Client::Request
concept, with the response body being treated as a remote flow source. - New command injection sinks have been added, including
Process.spawn
,Process.exec
,Terrapin::CommandLine
and theopen4
gem.
New Features¶
C/C++¶
- Added a
TaintInheritingContent
class that can be extended to model taint flowing from a qualifier to a field. - Added a predicate
GuardCondition.comparesEq/4
to query whether an expression is compared to a constant. - Added a predicate
GuardCondition.ensuresEq/4
to query whether a basic block is guarded by an expression being equal to a constant. - Added a predicate
GuardCondition.comparesLt/4
to query whether an expression is compared to a constant. - Added a predicate
GuardCondition.ensuresLt/4
to query whether a basic block is guarded by an expression being less than a constant. - Added a predicate
GuardCondition.valueControls
to query whether a basic block is guarded by a particularcase
of aswitch
statement.