CodeQL 2.13.3 (2023-05-31)¶
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.3 runs a total of 389 security queries when configured with the Default suite (covering 155 CWE). The Extended suite enables an additional 125 queries (covering 32 more CWE).
CodeQL CLI¶
Bug Fixes¶
Fixed a bug that could cause the compiler to infer incorrect binding sets for non-direct calls to overriding member predicates that have stronger binding sets than their root definitions.
Fixed a bug that could have caused the compiler to incorrectly infer that a class matched a type signature. The bug only affected classes with overriding member predicates that had stronger binding sets than their root definitions.
Fixed a bug where a query could not be run from VS Code when there were packs nested within sibling directories of the query.
New Features¶
This release enhances our preliminary Swift support, setting the stage for the upcoming public beta.
The
codeql database bundlecommand now supports the--[no]-include-tempoption. When enabled, this option will include thetempfolder of the database directory in the zip file of the bundled database. This folder includes generated packages and queries, and query suites.The structured log produced by
codeql generate log-summarynow includes a BooleanisCachedfield for predicate events, where atruevalue indicates the predicate is a wrapper implementing thecachedannotation on another predicate. The wrapper depends on the underlying predicate that the annotation was found on, and will usually have the same name, but it has a separateraHash.
Query Packs¶
Bug Fixes¶
JavaScript/TypeScript¶
Fixed a spurious diagnostic warning about comments in JSON files being illegal. Comments in JSON files are in fact fully supported, and the diagnostic message was misleading.
Major Analysis Improvements¶
JavaScript/TypeScript¶
Added taint sources from the
@actions/coreand@actions/githubpackages.Added command-injection sinks from the
@actions/execpackage.
Minor Analysis Improvements¶
Java/Kotlin¶
The query
java/groovy-injectionnow recognizesgroovy.text.TemplateEngine.createTemplateas a sink.The queries
java/xxeandjava/xxe-localnow recognize the second argument of calls toXPath.evaluateas a sink.Experimental sinks for the query “Resolving XML external entity in user-controlled data” (
java/xxe) have been promoted to the main query pack. These sinks were originally submitted as part of an experimental query by @haby0.
JavaScript/TypeScript¶
The
js/indirect-command-line-injectionquery no longer flags command arguments that cannot be interpreted as a shell string.The
js/unsafe-deserializationquery no longer flags deserialization through thejs-yamllibrary, except when it is used with an unsafe schema.The Forge module in
CryptoLibraries.qllnow correctly classifies SHA-512/224, SHA-512/256, and SHA-512/384 hashes used in message digests as NonKeyCiphers.
Language Libraries¶
Major Analysis Improvements¶
C/C++¶
In the intermediate representation, handling of control flow after non-returning calls has been improved. This should remove false positives in queries that use the intermedite representation or libraries based on it, including the new data flow library.
Minor Analysis Improvements¶
C/C++¶
The
StdNamespaceclass now also includes all inline namespaces that are children ofstdnamespace.The new dataflow (
semmle.code.cpp.dataflow.new.DataFlow) and taint-tracking libraries (semmle.code.cpp.dataflow.new.TaintTracking) now support tracking flow through static local variables.
C#¶
The
cs/log-forging,cs/cleartext-storage, andcs/exposure-of-sensitive-informationqueries now correctly handle unsanitized arguments toILoggerextension methods.Updated the
neutralModelextensible predicate to include akindcolumn.
Golang¶
Fixed data flow through variadic function parameters. The arguments corresponding to a variadic parameter are no longer returned by
CallNode.getArgument(int i)andCallNode.getAnArgument(), and hence aren’tArgumentNodes. They now have one result, which is anImplicitVarargsSlicenode. For example, a callf(a, b, c)to a functionf(T...)is treated likef([]T{a, b, c}). The old behaviour is preserved byCallNode.getSyntacticArgument(int i)andCallNode.getASyntacticArgument().CallExpr.getArgument(int i)andCallExpr.getAnArgument()are unchanged, and will still have three results in the example given.
Java/Kotlin¶
Added SQL injection sinks for Spring JDBC’s
NamedParameterJdbcOperations.Added models for the following packages:
org.apache.hadoop.fs
Added the
ArithmeticCommon.qlllibrary to provide predicates for reasoning about arithmetic operations.Added the
ArithmeticTaintedLocalQuery.qlllibrary to provide theArithmeticTaintedLocalOverflowFlowandArithmeticTaintedLocalUnderflowFlowtaint-tracking modules to reason about arithmetic with unvalidated user input.Added the
ArithmeticTaintedQuery.qlllibrary to provide theRemoteUserInputOverflowandRemoteUserInputUnderflowtaint-tracking modules to reason about arithmetic with unvalidated user input.Added the
ArithmeticUncontrolledQuery.qlllibrary to provide theArithmeticUncontrolledOverflowFlowandArithmeticUncontrolledUnderflowFlowtaint-tracking modules to reason about arithmetic with uncontrolled user input.Added the
ArithmeticWithExtremeValuesQuery.qlllibrary to provide theMaxValueFlowandMinValueFlowdataflow modules to reason about arithmetic with extreme values.Added the
BrokenCryptoAlgorithmQuery.qlllibrary to provide theInsecureCryptoFlowtaint-tracking module to reason about broken cryptographic algorithm vulnerabilities.Added the
ExecTaintedLocalQuery.qlllibrary to provide theLocalUserInputToArgumentToExecFlowtaint-tracking module to reason about command injection vulnerabilities caused by local data flow.Added the
ExternallyControlledFormatStringLocalQuery.qlllibrary to provide theExternallyControlledFormatStringLocalFlowtaint-tracking module to reason about format string vulnerabilities caused by local data flow.Added the
ImproperValidationOfArrayConstructionCodeSpecifiedQuery.qlllibrary to provide theBoundedFlowSourceFlowdataflow module to reason about improper validation of code-specified sizes used for array construction.Added the
ImproperValidationOfArrayConstructionLocalQuery.qlllibrary to provide theImproperValidationOfArrayConstructionLocalFlowtaint-tracking module to reason about improper validation of local user-provided sizes used for array construction caused by local data flow.Added the
ImproperValidationOfArrayConstructionQuery.qlllibrary to provide theImproperValidationOfArrayConstructionFlowtaint-tracking module to reason about improper validation of user-provided size used for array construction.Added the
ImproperValidationOfArrayIndexCodeSpecifiedQuery.qlllibrary to provide theBoundedFlowSourceFlowdata flow module to reason about about improper validation of code-specified array index.Added the
ImproperValidationOfArrayIndexLocalQuery.qlllibrary to provide theImproperValidationOfArrayIndexLocalFlowtaint-tracking module to reason about improper validation of a local user-provided array index.Added the
ImproperValidationOfArrayIndexQuery.qlllibrary to provide theImproperValidationOfArrayIndexFlowtaint-tracking module to reason about improper validation of user-provided array index.Added the
InsecureCookieQuery.qlllibrary to provide theSecureCookieFlowtaint-tracking module to reason about insecure cookie vulnerabilities.Added the
MaybeBrokenCryptoAlgorithmQuery.qlllibrary to provide theInsecureCryptoFlowtaint-tracking module to reason about broken cryptographic algorithm vulnerabilities.Added the
NumericCastTaintedQuery.qlllibrary to provide theNumericCastTaintedFlowtaint-tracking module to reason about numeric cast vulnerabilities.Added the
ResponseSplittingLocalQuery.qlllibrary to provide theResponseSplittingLocalFlowtaint-tracking module to reason about response splitting vulnerabilities caused by local data flow.Added the
SqlConcatenatedQuery.qlllibrary to provide theUncontrolledStringBuilderSourceFlowtaint-tracking module to reason about SQL injection vulnerabilities caused by concatenating untrusted strings.Added the
SqlTaintedLocalQuery.qlllibrary to provide theLocalUserInputToArgumentToSqlFlowtaint-tracking module to reason about SQL injection vulnerabilities caused by local data flow.Added the
StackTraceExposureQuery.qlllibrary to provide theprintsStackExternally,stringifiedStackFlowsExternally, andgetMessageFlowsExternallypredicates to reason about stack trace exposure vulnerabilities.Added the
TaintedPermissionQuery.qlllibrary to provide theTaintedPermissionFlowtaint-tracking module to reason about tainted permission vulnerabilities.Added the
TempDirLocalInformationDisclosureQuery.qlllibrary to provide theTempDirSystemGetPropertyToCreatetaint-tracking module to reason about local information disclosure vulnerabilities caused by local data flow.Added the
UnsafeHostnameVerificationQuery.qlllibrary to provide theTrustAllHostnameVerifierFlowtaint-tracking module to reason about insecure hostname verification vulnerabilities.Added the
UrlRedirectLocalQuery.qlllibrary to provide theUrlRedirectLocalFlowtaint-tracking module to reason about URL redirection vulnerabilities caused by local data flow.Added the
UrlRedirectQuery.qlllibrary to provide theUrlRedirectFlowtaint-tracking module to reason about URL redirection vulnerabilities.Added the
XPathInjectionQuery.qlllibrary to provide theXPathInjectionFlowtaint-tracking module to reason about XPath injection vulnerabilities.Added the
XssLocalQuery.qlllibrary to provide theXssLocalFlowtaint-tracking module to reason about XSS vulnerabilities caused by local data flow.Moved the
url-open-streamsink models to experimental and removedurl-open-streamas a sink option from the Customizing Library Models for Java documentation.Added models for the Apache Commons Net library.
Updated the
neutralModelextensible predicate to include akindcolumn.Added models for the
io.jsonwebtokenlibrary.
JavaScript/TypeScript¶
Improved the queries for injection vulnerabilities in GitHub Actions workflows (
js/actions/command-injectionandjs/actions/pull-request-target) and the associated librarysemmle.javascript.Actions. These now support steps defined in composite actions, in addition to steps defined in Actions workflow files. It supports more potentially untrusted input values. Additionally to the shell injections it now also detects injections inactions/github-script. It also detects simple injections from user controlled${{ env.name }}. Additionally to theymlextension now it also supports workflows with theyamlextension.
Python¶
Type tracking is now aware of reads of captured variables (variables defined in an outer scope). This leads to a richer API graph, and may lead to more results in some queries.
Added more content-flow/field-flow for dictionaries, by adding support for reads through
mydict.get("key")andmydict.setdefault("key", value), and store steps throughdict["key"] = valueandmydict.setdefault("key", value).
Ruby¶
Support for the
sqlite3gem has been added. Method calls that execute queries against an SQLite3 database that may be vulnerable to injection attacks will now be recognized.
New Features¶
C/C++¶
Added an AST-based interface (
semmle.code.cpp.rangeanalysis.new.RangeAnalysis) for the relative range analysis library.A new predicate
BarrierGuard::getAnIndirectBarrierNodehas been added to the new dataflow library (semmle.code.cpp.dataflow.new.DataFlow) to mark indirect expressions as barrier nodes using theBarrierGuardAPI.