CodeQL 2.16.1 (2024-01-25)¶
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.16.1 runs a total of 406 security queries when configured with the Default suite (covering 160 CWE). The Extended suite enables an additional 129 queries (covering 34 more CWE). 2 security queries have been added with this release.
CodeQL CLI¶
Improvements¶
When executing the
codeql database initcommand, the CodeQL runner executable path is now stored in theCODEQL_RUNNERenvironment variable. Users of indirect tracing on MacOS with System Integrity Protection enabled who previously had trouble with indirect tracing should prefix their build command with this path. For example,$CODEQL_RUNNER build.sh.
QL Language¶
Name clashes between weak aliases (i.e. aliases that are not final aliases of non-final entities) of the same target no longer cause ambiguity errors.
Query Packs¶
Minor Analysis Improvements¶
C/C++¶
The
cpp/include-non-headerstyle query will now ignore the.defextension for textual header inclusions.
C#¶
Modelled additional flow steps to track flow from handler methods of a
PageModelclass to the corresponding Razor Page (.cshtml) file, which may result in additional results for queries such ascs/web/xss.
Golang¶
The query
go/insecure-randomnessnow recognizes the selection of candidates from a predefined set using a weak RNG when the result is used in a sensitive operation. Also, false positives have been reduced by adding more sink exclusions for functions in thecryptopackage not related to cryptographic operations.Added more sources and sinks to the query
go/clear-text-logging.
Java/Kotlin¶
A manual neutral summary model for a callable now blocks all generated summary models for that callable from having any effect.
JavaScript/TypeScript¶
Added support for doT templates.
Python¶
Added modeling of YARL’s
is_absolutemethod and checks of thenetlocof a parsed URL as sanitizers for thepy/url-redirectionquery, leading to fewer false positives.
Swift¶
The diagnostic query
swift/diagnostics/successfully-extracted-filesnow considers any Swift file seen during extraction, even one with some errors, to be extracted / scanned. This affects the Code Scanning UI measure of scanned Swift files.
New Queries¶
Java/Kotlin¶
Added the
java/exec-tainted-environmentquery, to detect the injection of environment variables names or values from remote input.
Swift¶
Added new query “Use of an inappropriate cryptographic hashing algorithm on passwords” (
swift/weak-password-hashing). This query detects use of inappropriate hashing algorithms for password hashing. Some of the results of this query are new, others would previously have been reported by the “Use of a broken or weak cryptographic hashing algorithm on sensitive data” (swift/weak-sensitive-data-hashing) query.
Language Libraries¶
Bug Fixes¶
Java/Kotlin¶
Fixed regular expressions containing flags not being parsed correctly in some cases.
Minor Analysis Improvements¶
C/C++¶
Deleted many deprecated predicates and classes with uppercase
XML,SSA,SAL,SQL, etc. in their names. Use the PascalCased versions instead.Deleted the deprecated
StrcatFunctionclass, usesemmle.code.cpp.models.implementations.Strcat.qllinstead.
C#¶
Deleted many deprecated predicates and classes with uppercase
SSL,XML,URI,SSAetc. in their names. Use the PascalCased versions instead.Deleted the deprecated
getALocalFlowSuccpredicate andTaintTypeclass from the dataflow library.Deleted the deprecated
NewobjandRethrowclasses, useNewObjandReThrowinstead.Deleted the deprecated
getAFirstRead,hasAdjacentReads,lastRefBeforeRedef, andhasLastInputRefpredicates from the SSA library.Deleted the deprecated
getAReachableReadpredicate from theAssignableReadandVariableReadclasses.Deleted the deprecated
hasQualifiedNamepredicate from theNamedElementclass.C# 12: Add extractor support and QL library support for inline arrays.
Fixed a Log forging false positive when logging the value of a nullable simple type. This fix also applies to all other queries that use the simple type sanitizer.
The diagnostic query
cs/diagnostics/successfully-extracted-files, and therefore the Code Scanning UI measure of scanned C# files, now considers any C# file seen during extraction, even one with some errors, to be extracted / scanned.Added a new library
semmle.code.csharp.security.dataflow.flowsources.FlowSources, which provides a new classThreatModelFlowSource. TheThreatModelFlowSourceclass can be used to include sources which match the current threat model configuration.A manual neutral summary model for a callable now blocks all generated summary models for that callable from having any effect.
C# 12: Add extractor support for lambda expressions with parameter defaults like
(int x, int y = 1) => ...and lambda expressions with aparamparameter like(params int[] x) => ...).
Golang¶
Deleted many deprecated predicates and classes with uppercase
TLD,HTTP,SQL,URLetc. in their names. Use the PascalCased versions instead.Deleted the deprecated and unused
Sourceclass from theSharedXssmodule ofXss.qllSupport for flow sources in AWS Lambda function handlers has been added.
Support for the fasthttp framework has been added.
Java/Kotlin¶
Deleted many deprecated predicates and classes with uppercase
EJB,JMX,NFE,DNSetc. in their names. Use the PascalCased versions instead.Deleted the deprecated
semmle/code/java/security/OverlyLargeRangeQuery.qll,semmle/code/java/security/regexp/ExponentialBackTracking.qll,semmle/code/java/security/regexp/NfaUtils.qll, andsemmle/code/java/security/regexp/NfaUtils.qllfiles.Improved models for
java.lang.Throwableandjava.lang.Exception, and thevalueOfmethod ofjava.lang.String.Added taint tracking for the following GSON methods:
com.google.gson.stream.JsonReaderconstructorcom.google.gson.stream.JsonWriterconstructorcom.google.gson.JsonObject.getAsJsonArraycom.google.gson.JsonObject.getAsJsonObjectcom.google.gson.JsonObject.getAsJsonPrimitivecom.google.gson.JsonParser.parseReadercom.google.gson.JsonParser.parseString
Added a dataflow model for
java.awt.Desktop.browse(URI).
JavaScript/TypeScript¶
Deleted many deprecated predicates and classes with uppercase
CPU,TLD,SSA,ASMetc. in their names. Use the PascalCased versions instead.Deleted the deprecated
getMessageSuffixpredicates inCodeInjectionCustomizations.qll.Deleted the deprecated
semmle/javascript/security/dataflow/ExternalAPIUsedWithUntrustedData.qllfile.Deleted the deprecated
getANonHtmlHeaderDefinitionandnonHtmlContentTypeHeaderpredicates fromReflectedXssCustomizations.qll.Deleted the deprecated
semmle/javascript/security/OverlyLargeRangeQuery.qll,semmle/javascript/security/regexp/ExponentialBackTracking.qll,semmle/javascript/security/regexp/NfaUtils.qll, andsemmle/javascript/security/regexp/NfaUtils.qllfiles.Deleted the deprecated
Expressions/TypoDatabase.qllfile.The diagnostic query
js/diagnostics/successfully-extracted-files, and therefore the Code Scanning UI measure of scanned JavaScript and TypeScript files, now considers any JavaScript and TypeScript file seen during extraction, even one with some errors, to be extracted / scanned.
Python¶
Deleted many deprecated predicates and classes with uppercase
LDAP,HTTP,URL,CGIetc. in their names. Use the PascalCased versions instead.Deleted the deprecated
localSourceStoreSteppredicate, useflowsToStoreStepinstead.Deleted the deprecated
iteration_defined_variablepredicate from theSSAlibrary.Deleted various deprecated predicates from the points-to libraries.
Deleted the deprecated
semmle/python/security/OverlyLargeRangeQuery.qll,semmle/python/security/regexp/ExponentialBackTracking.qll,semmle/python/security/regexp/NfaUtils.qll, andsemmle/python/security/regexp/NfaUtils.qllfiles.The diagnostic query
py/diagnostics/successfully-extracted-files, and therefore the Code Scanning UI measure of scanned Python files, now considers any Python file seen during extraction, even one with some errors, to be extracted / scanned.
Ruby¶
Deleted many deprecated predicates and classes with uppercase
HTTP,CSRFetc. in their names. Use the PascalCased versions instead.Deleted the deprecated
getAUseandgetARhspredicates fromAPI::Node, usegetASourceandgetASinkinstead.Deleted the deprecated
disablesCertificateValidationpredicate from theHttpmodule.Deleted the deprecated
ParamsCall,CookiesCall, andActionControllerControllerClassclasses fromActionController.qll, use the simarly named classes fromcodeql.ruby.frameworks.Rails::Railsinstead.Deleted the deprecated
HtmlSafeCall,HtmlEscapeCall,RenderCall, andRenderToCallclasses fromActionView.qll, use the simarly named classes fromcodeql.ruby.frameworks.Rails::Railsinstead.Deleted the deprecated
HtmlSafeCallclass fromRails.qll.Deleted the deprecated
codeql/ruby/security/BadTagFilterQuery.qll,codeql/ruby/security/OverlyLargeRangeQuery.qll,codeql/ruby/security/regexp/ExponentialBackTracking.qll,codeql/ruby/security/regexp/NfaUtils.qll,codeql/ruby/security/regexp/RegexpMatching.qll, andcodeql/ruby/security/regexp/SuperlinearBackTracking.qllfiles.Deleted the deprecated
localSourceStoreSteppredicate fromTypeTracker.qll, useflowsToStoreStepinstead.The diagnostic query
rb/diagnostics/successfully-extracted-files, and therefore the Code Scanning UI measure of scanned Ruby files, now considers any Ruby file seen during extraction, even one with some errors, to be extracted / scanned.
Swift¶
Swift upgraded to 5.9.2
The control flow graph library (
codeql.swift.controlflow) has been transitioned to use the shared implementation from thecodeql/controlflowqlpack. No result changes are expected due to this change.
Deprecated APIs¶
Golang¶
The class
Fmt::AppenderOrSprinterof theFmt.qllmodule has been deprecated. Use the newFmt::AppenderOrSprinterFuncclass instead. Its taint flow features have been migrated to models-as-data.
New Features¶
Java/Kotlin¶
Added a new library
semmle.code.java.security.Sanitizerswhich contains a new sanitizer classSimpleTypeSanitizer, which represents nodes which cannot realistically carry taint for most queries (e.g. primitives, their boxed equivalents, and numeric types).Converted definitions of
isBarrierand sanitizer classes to useSimpleTypeSanitizerinstead of checking ifnode.getType()isPrimitiveTypeorBoxedType.