CodeQL 2.13.0 (2023-04-20)¶
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.13.0 runs a total of 388 security queries when configured with the Default suite (covering 155 CWE). The Extended suite enables an additional 124 queries (covering 30 more CWE). 2 security queries have been added with this release.
CodeQL CLI¶
Potentially Breaking Changes¶
In
codeql pack add, the dependency that is added to theqlpack.ymlfile will now allow any version of the pack that is compatible with the specified version (^version) in the following cases:When no version is specified (
codeql pack add codeql/cpp-all).When the version is specified as
latest(codeql pack add codeql/cpp-all@latest).When a single version is specified (
codeql pack add codeql/cpp-all@1.0.0).
The
^versiondependency allows any version of that pack with no breaking changes sinceversion. For example,^1.2.3would allow versions1.2.3,1.2.5, and1.4.0, but not2.0.0, because changing the major version number to2indicates a breaking change.Using
^versionensures that the added pack is not needlessly constrained to an exact version by default.Upper-case variable names are no longer accepted by the QL compiler.
Such variable names have produced a deprecation warning since release 2.9.2 (released 2022-05-16), so QL code that compiles without warnings with a recent release of the CLI should still work.
Deprecations¶
The possibility to omit
overrideannotations on class member predicates that override a base class predicate has been deprecated. This is to avoid confusion with shadowing behaviour in the presence of final member predicates.class Foo extends Base { final predicate foo() { ... } predicate bar() { ... } predicate baz() { ... } } class Bar extends Foo { // This method shadows Foo::foo. predicate foo() { ... } // This used to override Foo::bar with a warning, is now deprecated. predicate bar() { ... } // This correctly overrides Foo::baz override predicate baz() { ... } }
New Features¶
codeql database analyzeand related commands now export file coverage information by default. GHAS customers using CodeQL in third-party CI systems will now see file coverage information on the tool status page without needing to modify their CI workflows.
Known Issues¶
We recommend that customers using the CodeQL CLI in a third party CI system do not upgrade to this release, due to an issue with
codeql github upload-results. Instead, please use CodeQL 2.12.5, or, when available, CodeQL 2.12.7 or 2.13.1. For more information, see the “Known issues” section for CodeQL 2.12.6.
Query Packs¶
Bug Fixes¶
JavaScript/TypeScript¶
Fixed a bug where a destructuring pattern could not be parsed if it had a property named
getorsetwith a default value.
Python¶
Nonlocal variables are excluded from alerts.
Minor Analysis Improvements¶
C/C++¶
The query
cpp/tainted-arithmeticnow also flags possible overflows in arithmetic assignment operations.
C#¶
The query
cs/web/debug-binarynow disregards thedebugattribute in case there is a transformation that removes it.
Golang¶
The receiver arguments of
net/http.Header.Setand.Delare no longer flagged by querygo/untrusted-data-to-external-api.
JavaScript/TypeScript¶
The
DisablingCertificateValidation.qlquery has been updated to checkcreateServerfromhttpsfor disabled certificate validation.Improved the model of jQuery to account for XSS sinks where the HTML string is provided via a callback. This may lead to more results for the
js/xssquery.The
js/weak-cryptographic-algorithmquery now flags cryptograhic operations using a weak block mode, such as AES-ECB.
New Queries¶
C/C++¶
The query
cpp/redundant-null-check-simplehas been promoted to Code Scanning. The query finds cases where a pointer is compared to null after it has already been dereferenced. Such comparisons likely indicate a bug at the place where the pointer is dereferenced, or where the pointer is compared to null.
Java/Kotlin¶
The query
java/insecure-ldap-authhas been promoted from experimental to the main query pack. This query detects transmission of cleartext credentials in LDAP authentication. Insecure LDAP authentication causes sensitive information to be vulnerable to remote attackers. This query was originally submitted as an experimental query by @luchua-bc
Ruby¶
Added a new experimental query,
rb/server-side-template-injection, to detect cases where user input may be embedded into a template’s code in an unsafe manner.
Language Libraries¶
Bug Fixes¶
C/C++¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
C#¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
Golang¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
Java/Kotlin¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
Python¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular,
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
Ruby¶
Fixed some accidental predicate visibility in the backwards-compatible wrapper for data flow configurations. In particular
DataFlow::hasFlowPath,DataFlow::hasFlow,DataFlow::hasFlowTo, andDataFlow::hasFlowToExprwere accidentally exposed in a single version.
Breaking Changes¶
C/C++¶
The internal
SsaConsistencymodule has been moved fromSSAConstructiontoSSAConsitency, and the deprecatedSSAConsistencymodule has been removed.
Major Analysis Improvements¶
JavaScript/TypeScript¶
Added support for TypeScript 5.0.
Minor Analysis Improvements¶
C/C++¶
The
BufferAccesslibrary (semmle.code.cpp.security.BufferAccess) no longer matches buffer accesses inside unevaluated contexts (such as insidesizeofordecltypeexpressions). As a result, queries using this library may see fewer false positives.
Java/Kotlin¶
Fixed a bug in the regular expression used to identify sensitive information in
SensitiveActions::getCommonSensitiveInfoRegex. This may affect the results of the queriesjava/android/sensitive-communication,java/android/sensitive-keyboard-cache, andjava/sensitive-log.Added a summary model for the
java.lang.UnsupportedOperationException(String)constructor.The filenames embedded in
Compilation.toString()now use/as the path separator on all platforms.Added models for the following packages:
java.langjava.netjava.nio.filejava.iojava.lang.moduleorg.apache.commons.httpclient.utilorg.apache.commons.ioorg.apache.http.clientorg.eclipse.jetty.clientcom.google.common.iokotlin.io
Added the
TaintedPathQuery.qlllibrary to provide theTaintedPathFlowandTaintedPathLocalFlowtaint-tracking modules to reason about tainted path vulnerabilities.Added the
ZipSlipQuery.qlllibrary to provide theZipSlipFlowtaint-tracking module to reason about zip-slip vulnerabilities.Added the
InsecureBeanValidationQuery.qlllibrary to provide theBeanValidationFlowtaint-tracking module to reason about bean validation vulnerabilities.Added the
XssQuery.qlllibrary to provide theXssFlowtaint-tracking module to reason about cross site scripting vulnerabilities.Added the
LdapInjectionQuery.qlllibrary to provide theLdapInjectionFlowtaint-tracking module to reason about LDAP injection vulnerabilities.Added the
ResponseSplittingQuery.qlllibrary to provide theResponseSplittingFlowtaint-tracking module to reason about response splitting vulnerabilities.Added the
ExternallyControlledFormatStringQuery.qlllibrary to provide theExternallyControlledFormatStringFlowtaint-tracking module to reason about externally controlled format string vulnerabilities.Improved the handling of addition in the range analysis. This can cause in minor changes to the results produced by
java/index-out-of-boundsandjava/constant-comparison.A new models as data sink kind
command-injectionhas been added.The queries
java/command-line-injectionandjava/concatenated-command-linenow can be extended using thecommand-injectionmodels as data sink kind.Added more sink and summary dataflow models for the following packages:
java.netjava.nio.filejavax.imageio.streamjavax.namingjavax.servletorg.geogebra.web.full.mainhudsonhudson.clihudson.lifecyclehudson.modelhudson.scmhudson.utilhudson.util.io
Added the extensible abstract class
JndiInjectionSanitizer. Now this class can be extended to add more sanitizers to thejava/jndi-injectionquery.Added a summary model for the
nativeSQLmethod of thejava.sql.Connectioninterface.Added sink and summary dataflow models for the Jenkins and Netty frameworks.
The Models as Data syntax for selecting the qualifier has been changed from
-1tothis(e.g.Argument[-1]is now written asArgument[this]).Added sources and flow step models for the Netty framework up to version 4.1.
Added more dataflow models for frequently-used JDK APIs.
JavaScript/TypeScript¶
router.pushandrouter.replaceinNext.jsare now considered as XSS sink.The crypto-js module in
CryptoLibraries.qllnow supports progressive hashing with algo.update().
Python¶
Added modeling of SQL execution in the packages
sqlite3.dbapi2,cassandra-driver,aiosqlite, and the functionssqlite3.Connection.executescript/sqlite3.Cursor.executescriptandasyncpg.connection.connect().Fixed module resolution so we allow imports of definitions that have had an attribute assigned to it, such as
class Foo; Foo.bar = 42.
Ruby¶
Control flow graph: the evaluation order of scope expressions and receivers in multiple assignments has been adjusted to match the changes made in Ruby 3.1 and 3.2.
The clear-text storage (
rb/clear-text-storage-sensitive-data) and logging (rb/clear-text-logging-sensitive-data) queries now use built-in flow through hashes, for improved precision. This may result in both new true positives and less false positives.Accesses of
paramsin Sinatra applications are now recognized as HTTP input accesses.Data flow is tracked from Sinatra route handlers to ERB files.
Data flow is tracked between basic Sinatra filters (those without URL patterns) and their corresponding route handlers.
Deprecated APIs¶
C/C++¶
The single-parameter predicates
ArrayOrVectorAggregateLiteral.getElementExprandClassAggregateLiteral.getFieldExprhave been deprecated in favor ofArrayOrVectorAggregateLiteral.getAnElementExprandClassAggregateLiteral.getAFieldExpr.The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
The
SslContextCallAbstractConfig,SslContextCallConfig,SslContextCallBannedProtocolConfig,SslContextCallTls12ProtocolConfig,SslContextCallTls13ProtocolConfig,SslContextCallTlsProtocolConfig,SslContextFlowsToSetOptionConfig,SslOptionConfigdataflow configurations fromBoostorgAsiohave been deprecated. Please useSslContextCallConfigSig,SslContextCallGlobal,SslContextCallFlow,SslContextCallBannedProtocolFlow,SslContextCallTls12ProtocolFlow,SslContextCallTls13ProtocolFlow,SslContextCallTlsProtocolFlow,SslContextFlowsToSetOptionFlow.
C#¶
The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
Golang¶
The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
Java/Kotlin¶
The
execTaintedpredicate inCommandLineQuery.qllhas been deprecated and replaced with the predicateexecIsTainted.The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
The
WebViewDubuggingQuerylibrary has been renamed toWebViewDebuggingQueryto fix the typo in the file name.WebViewDubuggingQueryis now deprecated.
Python¶
The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
Ruby¶
The recently introduced new data flow and taint tracking APIs have had a number of module and predicate renamings. The old APIs remain in place for now.
New Features¶
C/C++¶
Added overridable predicates
getSizeExprandgetSizeMultto theBufferAccessclass (semmle.code.cpp.security.BufferAccess.qll). This makes it possible to model a larger class of buffer reads and writes using the library.
Java/Kotlin¶
Predicates
Compilation.getExpandedArgumentandCompilation.getAnExpandedArgumenthas been added.