CodeQL 2.9.0 (2022-04-26)¶
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-extensionoption tocodeql resolve filesandcodeql database index-filesdoes. The actual behavior is unchanged.
New Features¶
codeql database createnow supports the--[no-]-count-linesoption, which was previously only available withcodeql database init.codeql resolve filesandcodeql database index-fileshas a new--also-matchoption, which allows users to specify glob patterns that are applied in conjunction with the existing--includeoption.
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-transmissionquery now recognizes additional sources, for sensitive private data such as e-mail addresses and credit card numbers.The
cpp/unused-local-variableno longer ignores functions that include lambda expressions capturing trivially copyable objects.The
cpp/command-line-injectionquery 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 bothSwitchStmtandSwitchExpr, and the correspondinggetRuleStatement()no longer returns anExprStmtin either case. PreviouslySwitchStmtandSwitchExprbehaved 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.reducefunction.
New Queries¶
JavaScript/TypeScript¶
The
js/resource-exhaustionquery 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.
Query Metadata Changes¶
Java/Kotlin¶
Added the
security-severitytag to several queries.
Language Libraries¶
Bug Fixes¶
JavaScript/TypeScript¶
The following predicates on
API::Nodehave 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 = -1getAParameter()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, andisSanitizerOutin the data flow and taint tracking libraries have been removed.
C#¶
The recently added flow-state versions of
isBarrierIn,isBarrierOut,isSanitizerIn, andisSanitizerOutin the data flow and taint tracking libraries have been removed.
Java/Kotlin¶
The recently added flow-state versions of
isBarrierIn,isBarrierOut,isSanitizerIn, andisSanitizerOutin the data flow and taint tracking libraries have been removed.The
getUrlpredicate ofDeclaredRepositoryinMavenPom.qllhas been renamed togetRepositoryUrl.
Python¶
The recently added flow-state versions of
isBarrierIn,isBarrierOut,isSanitizerIn, andisSanitizerOutin the data flow and taint tracking libraries have been removed.
Ruby¶
The recently added flow-state versions of
isBarrierIn,isBarrierOut,isSanitizerIn, andisSanitizerOutin the data flow and taint tracking libraries have been removed.The
getURLmember-predicates of theHTTP::Client::RequestandHTTP::Client::Request::Rangeclasses fromConcepts.qllhave been renamed togetAUrlPart.
Major Analysis Improvements¶
Python¶
Added data-flow for Django ORM models that are saved in a database (no
models.ForeignKeysupport).
Minor Analysis Improvements¶
C/C++¶
The
semmle.code.cpp.security.SensitiveExprslibrary 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
Responseobjects, so passing a response body with the keyword argumentresponseis 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
ParseRegExpandRegExpTreeViewmodules are now “internal” modules. Users should usecodeql.ruby.Regexpinstead.
Deprecated APIs¶
Python¶
Queries importing a data-flow configuration from
semmle.python.security.dataflowshould ensure that the imported file ends withQuery, and only import its top-level module. For example, a query that usedCommandInjection::Configurationfromsemmle.python.security.dataflow.CommandInjectionshould from now useConfigurationfromsemmle.python.security.dataflow.CommandInjectionQueryinstead.
Ruby¶
ConstantValue::getStringOrSymbolandConstantValue::isStringOrSymbol, which return/hold for all string-like values (strings, symbols, and regular expressions), have been renamed toConstantValue::getStringlikeValueandConstantValue::isStringlikeValue, respectively. The old names have been marked asdeprecated.
New Features¶
C/C++¶
A new library
semmle.code.cpp.security.PrivateDatahas 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.