CodeQL 2.11.2 (2022-10-25)¶
Contents
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.11.2 runs a total of 357 security queries when configured with the Default suite (covering 150 CWE). The Extended suite enables an additional 111 queries (covering 31 more CWE). 5 security queries have been added with this release.
CodeQL CLI¶
Breaking Changes¶
Bundling and publishing a CodeQL pack will no longer include nested CodeQL packs. If you want to include a nested pack in your published pack, then you must explicitly include it using the
include
property in the top-levelqlpack.yml
file.For example, if your package structure looks like this:
qlpack.yml nested-pack ∟ qlpack.yml query.ql
then the contents of
nested-pack
will not be included by default within the published package. To includenested-pack
, add an entry like this to the top levelqlpack.yml
file:include: - nested-pack/**
Bug Fixes¶
- Using the
--codescanning-config=<file>
option incodeql database init
will now correctly process thepaths
andpathsIgnore
properties of the configuration file in a way that is identical to the behavior of thecodeql-action
. Previously,paths
orpathsIgnore
entries that end in/**
or start with/
were incorrectly rejected by the CLI. - Fixed a bug where the
--compilation-cache
option tocodeql pack publish
andcodeql pack create
was being ignored when creating a query pack. Now, the indicated cache is used when pre-compiling the queries in it. - Fixed a bug that would make the “Show DIL” command in the VSCode extension display nothing.
Miscellaneous¶
- Emit a detailed warning if package resolution fails, the legacy
--search-path
option is provided, and there is at least one referenced pack that does not use legacy package resolution. In this case,--additional-packs
should be used to extend the search to additional directories, instead of--search-path
.
Query Packs¶
Bug Fixes¶
Python¶
- Fixed how
flask.request
is modeled as a RemoteFlowSource, such that we show fewer duplicated alert messages for Code Scanning alerts. The import, such asfrom flask import request
, will now be shown as the first step in a path explanation.
Minor Analysis Improvements¶
C/C++¶
- The “Unterminated variadic call” (
cpp/unterminated-variadic-call
) query has been tuned to produce fewer false positive results. - Fixed false positives from the “Unused static function” (
cpp/unused-static-function
) query in files that had errors during compilation.
Golang¶
- The alert messages of many queries were changed to better follow the style guide and make the messages consistent with other languages.
JavaScript/TypeScript¶
- Removed some false positives from the
js/file-system-race
query by requiring that the file-check dominates the file-access. - Improved taint tracking through
JSON.stringify
in cases where a tainted value is stored somewhere in the input object.
Python¶
- Added model of
cx_Oracle
,oracledb
,phonenixdb
andpyodbc
PyPI packages as a SQL interface following PEP249, resulting in additional sinks forpy/sql-injection
. - Added model of
executemany
calls on PEP-249 compliant database APIs, resulting in additional sinks forpy/sql-injection
. - Added model of
pymssql
PyPI package as a SQL interface following PEP249, resulting in additional sinks forpy/sql-injection
. - The alert messages of many queries were changed to better follow the style guide and make the messages consistent with other languages.
Ruby¶
- HTTP response header and body writes via
ActionDispatch::Response
are now recognized. - The
rb/path-injection
query now treats thefile:
argument of the Railsrender
method as a sink. - The alert messages of many queries were changed to better follow the style guide and make the messages consistent with other languages.
New Queries¶
C/C++¶
- Added a new medium-precision query,
cpp/comma-before-misleading-indentation
, which detects instances of whitespace that have readability issues.
Java/Kotlin¶
- Added a new query,
java/android/incomplete-provider-permissions
, to detect if an Android ContentProvider is not protected with a correct set of permissions. - A new query “Uncontrolled data used in content resolution” (
java/androd/unsafe-content-uri-resolution
) has been added. This query finds paths from user-provided data to URI resolution operations in Android’sContentResolver
without previous validation or sanitization.
Ruby¶
- Added a new query,
rb/non-constant-kernel-open
, to detect uses of Kernel.open and related methods with non-constant values. - Added a new query,
rb/sensitive-get-query
, to detect cases where sensitive data is read from the query parameters of an HTTPGET
request.
Language Libraries¶
Minor Analysis Improvements¶
Java/Kotlin¶
- Added support for common patterns involving
Stream.collect
and common collectors likeCollectors.toList()
. - The class
TypeVariable
now also extendsModifiable
. - Added data flow steps for tainted Android intents that are sent to services and receivers.
- Improved the data flow step for tainted Android intents that are sent to activities so that more cases are covered.
Python¶
- Fixed labels in the API graph pertaining to definitions of subscripts. Previously, these were found by
getMember
rather thangetASubscript
. - Added edges for indices of subscripts to the API graph. Now a subscripted API node will have an edge to the API node for the index expression. So if
foo
is matched by API nodeA
, then"key"
infoo["key"]
will be matched by the API nodeA.getIndex()
. This can be used to track the origin of the index. - Added member predicate
getSubscriptAt(API::Node index)
toAPI::Node
. LikegetASubscript()
, this will return an API node that matches a subscript of the node, but here it will be restricted to subscripts where the index matches theindex
parameter. - Added convenience predicate
getSubscript("key")
to obtain a subscript at a specific index, when the index happens to be a statically known string.
Ruby¶
- The hashing algorithms from
Digest
andOpenSSL::Digest
are now recognized and can be flagged by therb/weak-cryptographic-algorithm
query. - More sources of remote input arising from methods on
ActionDispatch::Request
are now recognized. - The response value returned by the
Faraday#run_request
method is now also considered a source of remote input. ActiveJob::Serializers.deserialize
is considered to be a code execution sink.- Calls to
params
inActionMailer
classes are now treated as sources of remote user input. - Taint flow through
ActionController::Parameters
is tracked more accurately.