CodeQL 2.9.0 (2022-04-26)¶
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.9.0 runs a total of 325 security queries when configured with the Default suite (covering 140 CWE). The Extended suite enables an additional 102 queries (covering 29 more CWE). 13 security queries have been added with this release.
CodeQL CLI¶
Bug Fixes¶
- Fixed a bug that would prevent resolution of a query suite in a published CodeQL query pack that has a reference to the pack itself.
- Fixed inaccurate documentation of what the
--include-extension
option tocodeql resolve files
andcodeql database index-files
does. The actual behavior is unchanged.
New Features¶
codeql database create
now supports the--[no-]-count-lines
option, which was previously only available withcodeql database init
.codeql resolve files
andcodeql database index-files
has a new--also-match
option, which allows users to specify glob patterns that are applied in conjunction with the existing--include
option.
QL Language¶
- This release introduces experimental support for parameterized QL modules. This language feature is still subject to change and should not be used in production yet.
Query Packs¶
Minor Analysis Improvements¶
C/C++¶
- The
cpp/cleartext-transmission
query now recognizes additional sources, for sensitive private data such as e-mail addresses and credit card numbers. - The
cpp/unused-local-variable
no longer ignores functions that include lambda expressions capturing trivially copyable objects. - The
cpp/command-line-injection
query now takes into account calling contexts across string concatenations. This removes false positives due to mismatched calling contexts before and after string concatenations. - A new query, “Potential exposure of sensitive system data to an unauthorized control sphere” (
cpp/potential-system-data-exposure
) has been added. This query is focused on exposure of information that is highly likely to be sensitive, whereas the similar query “Exposure of system data to an unauthorized control sphere” (cpp/system-data-exposure
) is focused on exposure of information on a channel that is more likely to be intercepted by an attacker.
Java/Kotlin¶
- Fixed “Local information disclosure in a temporary directory” (
java/local-temp-file-or-directory-information-disclosure
) to resolve false-negatives when OS isn’t properly used as logical guard. - The
SwitchCase.getRuleExpression()
predicate now gets expressions for case rules with an expression on the right-hand side of the arrow belonging to bothSwitchStmt
andSwitchExpr
, and the correspondinggetRuleStatement()
no longer returns anExprStmt
in either case. PreviouslySwitchStmt
andSwitchExpr
behaved differently in this respect.
JavaScript/TypeScript¶
- Improved handling of custom DOM elements, potentially leading to more alerts for the XSS queries.
- Improved taint tracking through calls to the
Array.prototype.reduce
function.
New Queries¶
JavaScript/TypeScript¶
- The
js/resource-exhaustion
query has been added. It highlights locations where an attacker can cause a large amount of resources to be consumed. The query previously existed as an experimental query.
Ruby¶
- Added a new query,
rb/insecure-dependency
. The query finds cases where Ruby gems may be downloaded over an insecure communication channel. - Added a new query,
rb/weak-cryptographic-algorithm
. The query finds uses of cryptographic algorithms that are known to be weak, such as DES. - Added a new query,
rb/http-tainted-format-string
. The query finds cases where data from remote user input is used in a string formatting method in a way that allows arbitrary format specifiers to be inserted. - Added a new query,
rb/http-to-file-access
. The query finds cases where data from remote user input is written to a file. - Added a new query,
rb/incomplete-url-substring-sanitization
. The query finds instances where a URL is incompletely sanitized due to insufficient checks.
Language Libraries¶
Bug Fixes¶
JavaScript/TypeScript¶
- The following predicates on
API::Node
have been changed so as not to include the receiver. The receiver should now only be accessed viagetReceiver()
.getParameter(int i)
previously included the receiver wheni = -1
getAParameter()
previously included the receivergetLastParameter()
previously included the receiver for calls with no arguments
Breaking Changes¶
C/C++¶
- The recently added flow-state versions of
isBarrierIn
,isBarrierOut
,isSanitizerIn
, andisSanitizerOut
in the data flow and taint tracking libraries have been removed.
C#¶
- The recently added flow-state versions of
isBarrierIn
,isBarrierOut
,isSanitizerIn
, andisSanitizerOut
in the data flow and taint tracking libraries have been removed.
Java/Kotlin¶
- The recently added flow-state versions of
isBarrierIn
,isBarrierOut
,isSanitizerIn
, andisSanitizerOut
in the data flow and taint tracking libraries have been removed. - The
getUrl
predicate ofDeclaredRepository
inMavenPom.qll
has been renamed togetRepositoryUrl
.
Python¶
- The recently added flow-state versions of
isBarrierIn
,isBarrierOut
,isSanitizerIn
, andisSanitizerOut
in the data flow and taint tracking libraries have been removed.
Ruby¶
- The recently added flow-state versions of
isBarrierIn
,isBarrierOut
,isSanitizerIn
, andisSanitizerOut
in the data flow and taint tracking libraries have been removed. - The
getURL
member-predicates of theHTTP::Client::Request
andHTTP::Client::Request::Range
classes fromConcepts.qll
have been renamed togetAUrlPart
.
Major Analysis Improvements¶
Python¶
- Added data-flow for Django ORM models that are saved in a database (no
models.ForeignKey
support).
Minor Analysis Improvements¶
C/C++¶
- The
semmle.code.cpp.security.SensitiveExprs
library has been enhanced with some additional rules for detecting credentials.
Java/Kotlin¶
- Added guard precondition support for assertion methods for popular testing libraries (e.g. Junit 4, Junit 5, TestNG).
Python¶
- Improved modeling of Flask
Response
objects, so passing a response body with the keyword argumentresponse
is now recognized.
Ruby¶
- Whereas
ConstantValue::getString()
previously returned both string and regular-expression values, it now returns only string values. The same applies toConstantValue::isString(value)
. - Regular-expression values can now be accessed with the new predicates
ConstantValue::getRegExp()
,ConstantValue::isRegExp(value)
, andConstantValue::isRegExpWithFlags(value, flags)
. - The
ParseRegExp
andRegExpTreeView
modules are now “internal” modules. Users should usecodeql.ruby.Regexp
instead.
Deprecated APIs¶
Python¶
- Queries importing a data-flow configuration from
semmle.python.security.dataflow
should ensure that the imported file ends withQuery
, and only import its top-level module. For example, a query that usedCommandInjection::Configuration
fromsemmle.python.security.dataflow.CommandInjection
should from now useConfiguration
fromsemmle.python.security.dataflow.CommandInjectionQuery
instead.
Ruby¶
ConstantValue::getStringOrSymbol
andConstantValue::isStringOrSymbol
, which return/hold for all string-like values (strings, symbols, and regular expressions), have been renamed toConstantValue::getStringlikeValue
andConstantValue::isStringlikeValue
, respectively. The old names have been marked asdeprecated
.
New Features¶
C/C++¶
- A new library
semmle.code.cpp.security.PrivateData
has been added. The new library heuristically detects variables and functions dealing with sensitive private data, such as e-mail addresses and credit card numbers.
Java/Kotlin¶
- There are now QL classes ErrorExpr and ErrorStmt. These may be generated by upgrade or downgrade scripts when databases cannot be fully converted.