CodeQL 2.12.5 (2023-03-21)¶
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.12.5 runs a total of 385 security queries when configured with the Default suite (covering 154 CWE). The Extended suite enables an additional 124 queries (covering 31 more CWE). 2 security queries have been added with this release.
CodeQL CLI¶
Bug Fixes¶
Fix a bug in
codeql query runwhere queries whose path contain colons cannot be run.
New Features¶
The
codeql pack installcommand now accepts a--additional-packsoption. This option takes a list of directories to search for locally available packs when resolving which packs to install. Any pack that is found locally through--additional-packswill override any other version of a pack found in the package registry. Locally resolved packs are not added to the lock file.Because the use of
--additional-packswhen runningcodeql pack installmakes running queries dependent on the local state of the machine initially invokingcodeql pack install, a warning is emitted if any pack is found outside of the package registry. This warning can be suppressed by using the--no-strict-modeoption.
Query Packs¶
Minor Analysis Improvements¶
JavaScript/TypeScript¶
The following queries now recognize HTML sanitizers as propagating taint:
js/sql-injection,js/path-injection,js/server-side-unvalidated-url-redirection,js/client-side-unvalidated-url-redirection, andjs/request-forgery.
Deprecated Queries¶
C/C++¶
The
NetworkToBufferSizeConfigurationandUntrustedDataToExternalApiConfigdataflow configurations have been deprecated. Please useNetworkToBufferSizeFlowandUntrustedDataToExternalApiFlow.The
LeapYearCheckConfiguration,FiletimeYearArithmeticOperationCheckConfiguration, andPossibleYearArithmeticOperationCheckConfigurationdataflow configurations have been deprecated. Please useLeapYearCheckFlow,FiletimeYearArithmeticOperationCheckFlowandPossibleYearArithmeticOperationCheckFlow.
New Queries¶
Java/Kotlin¶
Added a new query,
java/android/arbitrary-apk-installation, to detect installation of APKs from untrusted sources.
Python¶
Added a new query,
py/shell-command-constructed-from-input, to detect libraries that unsafely construct shell commands from their inputs.
Ruby¶
Added a new query,
rb/zip-slip, to detect arbitrary file writes during extraction of zip/tar archives.
Language Libraries¶
Breaking Changes¶
C/C++¶
The
semmle.code.cpp.commons.Bufferandsemmle.code.cpp.commons.NullTerminationlibraries no longer exposesemmle.code.cpp.dataflow.DataFlow. Please importsemmle.code.cpp.dataflow.DataFlowdirectly.
Major Analysis Improvements¶
C/C++¶
A new C/C++ dataflow library (
semmle.code.cpp.dataflow.new.DataFlow) has been added. The new library behaves much more like the dataflow library of other CodeQL supported languages by following use-use dataflow paths instead of def-use dataflow paths. The new library also better supports dataflow through indirections, and new predicates such asNode::asIndirectExprhave been added to facilitate working with indirections.The
semmle.code.cpp.ir.dataflow.DataFlowlibrary is now identical to the newsemmle.code.cpp.dataflow.new.DataFlowlibrary.The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
C#¶
The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
Golang¶
The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
Java/Kotlin¶
Removed low-confidence call edges to known neutral call targets from the call graph used in data flow analysis. This includes, for example, custom
List.containsimplementations when the best inferrable type at the call site is simplyList.Added more sink and summary dataflow models for the following packages:
java.iojava.langjava.sqljavafx.scene.weborg.apache.commons.compress.archivers.tarorg.apache.http.client.utilsorg.codehaus.cargo.container.installer
The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
Python¶
The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
Ruby¶
The main data flow and taint tracking APIs have been changed. The old APIs remain in place for now and translate to the new through a backwards-compatible wrapper. If multiple configurations are in scope simultaneously, then this may affect results slightly. The new API is quite similar to the old, but makes use of a configuration module instead of a configuration class.
Minor Analysis Improvements¶
C/C++¶
Deleted the deprecated
hasGeneratedCopyConstructorandhasGeneratedCopyAssignmentOperatorpredicates from theFolderclass.Deleted the deprecated
getPathandgetFolderpredicates from theXmlFileclass.Deleted the deprecated
getMustlockFunction,getTrylockFunction,getLockFunction, andgetUnlockFunctionpredicates from theMutexTypeclass.Deleted the deprecated
getPosInBasicBlockpredicate from theSubBasicBlockclass.Deleted the deprecated
getExprpredicate from thePointerDereferenceExprclass.Deleted the deprecated
getUseInstructionandgetDefinitionInstructionpredicates from theOperandclass.Deleted the deprecated
isInParameter,isInParameterPointer, andisInQualifierpredicates from theFunctionInputclass.Deleted the deprecated
isOutParameterPointer,isOutQualifier,isOutReturnValue, andisOutReturnPointerpredicate from theFunctionOutputclass.Deleted the deprecated 3-argument
isGuardPhipredicate from theRangeSsaDefinitionclass.
C#¶
Deleted the deprecated
getPathandgetFolderpredicates from theXmlFileclass.Deleted the deprecated
getAssertionIndex, andgetAssertedParameterpredicates from theAssertMethodclass.Deleted the deprecated
OverridableMethodandOverridableAccessorclasses.The
unsafepredicate forModifiablehas been extended to cover delegate return types and identify pointer-like types at any nest level. This is relevant forunsafedeclarations extracted from assemblies.
Java/Kotlin¶
Deleted the deprecated
getPathandgetFolderpredicates from theXmlFileclass.Deleted the deprecated
getRepresentedStringpredicate from theStringLiteralclass.Deleted the deprecated
ServletWriterSourceclass.Deleted the deprecated
getGroupID,getArtefactID, andartefactMatchespredicates from theMavenRepoJarclass.
JavaScript/TypeScript¶
Deleted the deprecated
getPathandgetFolderpredicates from theXmlFileclass.Deleted the deprecated
getIdfrom theFunction,NamespaceDefinition, andImportEqualsDeclarationclasses.Deleted the deprecated
flowsTopredicate from theHTTP::Servers::RequestSourceandHTTP::Servers::ResponseSourceclass.Deleted the deprecated
getEventNamepredicate from theSocketIO::ReceiveNode,SocketIO::SendNode,SocketIOClient::SendNodeclasses.Deleted the deprecated
RateLimitedRouteHandlerExprandRouteHandlerExpressionWithRateLimiterclasses.Import assertions are now supported. Previously this feature was only supported in TypeScript code, but is now supported for plain JavaScript as well and is also accessible in the AST.
Python¶
Deleted the deprecated
getPathandgetFolderpredicates from theXmlFileclass.
Ruby¶
Data flow through
initializemethods is now taken into account also when the receiver of anewcall is an (implicit or explicit)self.The Active Record query methods
reorderandcount_by_sqlare now recognized as SQL executions.Calls to
ActiveRecord::Connection#execute, including those via subclasses, are now recognized as SQL executions.Data flow through
ActionController::Parameters#requireis now tracked properly.The severity of parse errors was reduced to warning (previously error).
Deleted the deprecated
getQualifiedNamepredicate from theConstantWriteAccessclass.Deleted the deprecated
getWhenBranchandgetAWhenBranchpredicates from theCaseExprclass.Deleted the deprecated
Self,PatternParameter,Pattern,VariablePattern,TuplePattern, andTuplePatternParameterclasses.
Deprecated APIs¶
C/C++¶
The
WriteConfigtaint tracking configuration has been deprecated. Please useWriteFlow.
New Features¶
C/C++¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.
C#¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.
Golang¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.
Java/Kotlin¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.
Python¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.
Ruby¶
Added support for merging two
PathGraphs via disjoint union to allow results from multiple data flow computations in a singlepath-problemquery.