CodeQL 2.15.1 (2023-10-19)¶
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.15.1 runs a total of 398 security queries when configured with the Default suite (covering 158 CWE). The Extended suite enables an additional 128 queries (covering 33 more CWE). 1 security query has been added with this release.
CodeQL CLI¶
Potentially Breaking Changes¶
The query server’s
evaluation/trimCachecommand was previously equivalent to thecodeql database cleanup --mode=gentleCLI command, but is now equivalent to using--mode=normal. The new meaning of the command is to clear the entire evaluation cache of a database except for predicates annotated with thecachedkeyword.
Bug Fixes¶
Fixed a bug where the
$CODEQL_JAVA_HOMEenvironment variable was erroneously ignored for certain subsidiary Java processes started bycodeql.Fixed a bug in the CodeQL build tracer on Apple Silicon machines that prevented database creation if System Integrity Protection was disabled.
Deprecations¶
The accepted values of the
--modeoption forcodeql database cleanuphave been renamed to bring them in line with what they are called in the VSCode extension and the query server:--mode=brutalis now--mode=clear.--mode=normalis now--mode=trim.--mode=lightis now--mode=fit.The old names are deprecated, but will be accepted for backwards-compatibility reasons until further notice.
Improvements¶
The list of failed tests at the end of a
codeql test runis now sorted lexicographically.The syntax of DIL now more closely resembles the QL source code that it is compiled from. In particular, conjunctions and disjunctions now use the familiar
andandorkeywords, and clauses are enclosed in curly braces.
Query Packs¶
Minor Analysis Improvements¶
C#¶
The
cs/web/insecure-direct-object-referenceandcs/web/missing-function-level-access-controlhave been improved to better recognize attributes on generic classes.
Golang¶
The query “Incorrect conversion between integer types” (
go/incorrect-integer-conversion) has been improved. It can now detect parsing an unsigned integer type (likeuint32) and converting it to the signed integer type of the same size (likeint32), which may lead to more results. It also treatsintanduintmore carefully, which may lead to more results or fewer incorrect results.
Java/Kotlin¶
Most data flow queries that track flow from remote flow sources now use the current threat model configuration instead. This doesn’t lead to any changes in the produced alerts (as the default configuration is remote flow sources) unless the threat model configuration is changed.
JavaScript/TypeScript¶
Added the
AmdModuleDefinition::Rangeclass, making it possible to define custom aliases for the AMDdefinefunction.
Swift¶
Added more new logging sinks to the
swift/cleartext-loggingquery.Added sinks for the GRDB database library to the
swift/hardcoded-keyquery.Added sqlite3 and SQLite.swift sinks and flow summaries for the
swift/hardcoded-keyquery.Added sqlite3 and SQLite.swift sinks and flow summaries for the
swift/cleartext-storage-databasequery.
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.Note: This query was incorrectly noted as being promoted to Code Scanning in CodeQL version 2.14.6.
Ruby¶
Added a new experimental query,
rb/jwt-empty-secret-or-algorithm, to detect when application uses an empty secret or weak algorithm.Added a new experimental query,
rb/jwt-missing-verification, to detect when the application does not verify a JWT payload.
Language Libraries¶
Minor Analysis Improvements¶
C/C++¶
Deleted the deprecated
AnalysedStringclass, use the new nameAnalyzedString.Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.
C#¶
Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.
Golang¶
Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.Support has been added for file system access sinks in the following libraries: net/http, Afero, beego, Echo, Fiber, Gin, Iris.
Added
GoKit.qlltogo.qllenabling the GoKit framework by default
Java/Kotlin¶
The
isBarrier,isBarrierIn,isBarrierOut, andisAdditionalFlowStepmethods of the taint-tracking configurations for local queries in theArithmeticTaintedLocalQuery,ExternallyControlledFormatStringLocalQuery,ImproperValidationOfArrayIndexQuery,NumericCastTaintedQuery,ResponseSplittingLocalQuery,SqlTaintedLocalQuery, andXssLocalQuerylibraries have been changed to match their remote counterpart configurations.Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.Deleted the deprecated
getAValuepredicate from theAnnotationclass.Deleted the deprecated alias
FloatingPointLiteral, useFloatLiteralinstead.Deleted the deprecated
getASuppressedWarningLiteralpredicate from theSuppressWarningsAnnotationclass.Deleted the deprecated
getATargetExpressionpredicate form theTargetAnnotationclass.Deleted the deprecated
getRetentionPolicyExpressionpredicate from theRetentionAnnotationclass.Deleted the deprecated
conditionCheckpredicate fromPreconditions.qll.Deleted the deprecated
semmle.code.java.security.performancefolder, usesemmle.code.java.security.regexpinstead.Deleted the deprecated
ExternalAPIclass fromExternalApi.qll, useExternalApiinstead.Modified the
EnvInputclass insemmle.code.java.dataflow.FlowSourcesto includeenvironmentandfilesource nodes. There are no changes to results unless you add source models using theenvironmentorfilesource kinds.Added
environmentsource models for the following methods:java.lang.System#getenvjava.lang.System#getPropertiesjava.lang.System#getPropertyjava.util.Properties#getjava.util.Properties#getProperty
Added
filesource models for the following methods:the
java.io.FileInputStreamconstructorhudson.FilePath#newInputStreamDenyingSymlinkAsNeededhudson.FilePath#openInputStreamhudson.FilePath#readhudson.FilePath#readFromOffsethudson.FilePath#readToString
Modified the
DatabaseInputclass insemmle.code.java.dataflow.FlowSourcesto includedatabasesource nodes. There are no changes to results unless you add source models using thedatabasesource kind.Added
databasesource models for the following method:java.sql.ResultSet#getString
JavaScript/TypeScript¶
The contents of
.jspfiles are now extracted, and any<script>tags inside these files will be parsed as JavaScript.Import attributes are now supported in JavaScript code. Note that import attributes are an evolution of an earlier proposal called “import assertions”, which were implemented in TypeScript 4.5. The QL library includes new predicates named
getImportAttributes()that should be used in favor of the now deprecatedgetImportAssertion(); in addition, thegetImportAttributes()method of theDynamicImportExprhas been renamed togetImportOptions().Deleted the deprecated
getAnImmediateUse,getAUse,getARhs, andgetAValueReachingRhspredicates from theAPI::Nodeclass.Deleted the deprecated
mayReferToParameterpredicate fromDataFlow::Node.Deleted the deprecated
getStaticMethodandgetAStaticMethodpredicates fromDataFlow::ClassNode.Deleted the deprecated
isLibaryFilepredicate fromClassifyFiles.qll, useisLibraryFileinstead.Deleted many library models that were build on the AST. Use the new models that are build on the dataflow library instead.
Deleted the deprecated
semmle.javascript.security.performancefolder, usesemmle.javascript.security.regexpinstead.Tagged template literals have been added to
DataFlow::CallNode. This allows the analysis to find flow into functions called with a tagged template literal, and the arguments to a tagged template literal are part of the API-graph inApiGraphs.qll.
Python¶
Added better support for API graphs when encountering
from ... import *. For example in the codefrom foo import *; Bar(), we will now find a result forAPI::moduleImport("foo").getMember("Bar").getACall()Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.Deleted the deprecated
getAUse,getAnImmediateUse,getARhs, andgetAValueReachingRhspredicates from theAPI::Nodeclass.Deleted the deprecated
fullyQualifiedToAPIGraphPathclass fromSubclassFinder.qll, usefullyQualifiedToApiGraphPathinstead.Deleted the deprecated
Paths.qllfile.Deleted the deprecated
semmle.python.security.performancefolder, usesemmle.python.security.regexpinstead.Deleted the deprecated
semmle.python.security.stringsandsemmle.python.webfolders.Improved modeling of decoding through pickle related functions (which can lead to code execution), resulting in additional sinks for the Deserializing untrusted input query (
py/unsafe-deserialization). Added support forpandas.read_pickle,numpy.loadandjoblib.load.
Ruby¶
Deleted the deprecated
isBarrierGuardpredicate from the dataflow library and its uses, useisBarrierand theBarrierGuardmodule instead.Deleted the deprecated
isWeakpredicate from theCryptographicOperationclass.Deleted the deprecated
getStringOrSymbolandisStringOrSymbolpredicates from theConstantValueclass.Deleted the deprecated
getAPIfrom theIOOrFileMethodCallclass.Deleted the deprecated
codeql.ruby.security.performancefolder, usecodeql.ruby.security.regexpinstead.GraphQL enums are no longer considered remote flow sources.
Swift¶
Improved taint models for
Numerictypes andRangeReplaceableCollections.The nil-coalescing operator
??is now supported by the CFG construction and dataflow libraries.The data flow library now supports flow to the loop variable of for-in loops.
The methods
getIteratorVarandgetNextCallhave been added to theForEachStmtclass.
New Features¶
Java/Kotlin¶
Added predicate
MemberRefExpr::getReceiverExpr