CodeQL 2.9.2 (2022-05-16)¶
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.9.2 runs a total of 330 security queries when configured with the Default suite (covering 141 CWE). The Extended suite enables an additional 104 queries (covering 29 more CWE). 4 security queries have been added with this release.
CodeQL CLI¶
Bug Fixes¶
Fixed a bug that could make it unpredictable whether the QL compiler reports problems about query metadata tags, and thereby make
codeql test runfail spuriously in some cases.
New Features¶
The tables produced by
codeql database analyzesummarizing the results of any diagnostic and metric queries that were run now exclude the results of queries taggedtelemetry.Uploading SARIF results using the
codeql github upload-resultscommand now has a timeout of 5 minutes.Downloading CodeQL packs using the
codeql pack download,codeql pack installand related commands now have a timeout of 5 minutes and will retry 3 times before failing. Similar behavior has been added to thecodeql pack publishcommand.The
codeql generate log-summarycommand will now print progress updates tostderr.
Removed Features¶
The table printed by
codeql database analyzeto summarize the results of metric queries that were part of the analysis now reports a single row per metric name independently of the verbosity level of the command. Previously, at higher verbosity levels, this table would contain multiple rows for metric names with multiple values.
Query Packs¶
Minor Analysis Improvements¶
C/C++¶
The “XML external entity expansion” (
cpp/external-entity-expansion) query has been extended to support a broader selection of XML libraries and interfaces.
Java/Kotlin¶
Query
java/insecure-cookienow tolerates setting a cookie’s secure flag torequest.isSecure(). This means servlets that intentionally accept unencrypted connections will no longer raise an alert.The query
java/non-https-urlshas been simplified and no longer requires its sinks to beMethodAccesses.The logic to detect
WebViews with JavaScript (and optionally file access) enabled in the queryjava/android/unsafe-android-webview-fetchhas been improved.
New Queries¶
JavaScript/TypeScript¶
The
js/missing-origin-checkquery has been added. It highlights “message” event handlers that do not check the origin of the event.The query previously existed as the experimental
js/missing-postmessageorigin-verificationquery.
Python¶
“XML external entity expansion” (
py/xxe). Results will appear by default. This query was based on an experimental query by @jorgectf.“XML internal entity expansion” (
py/xml-bomb). Results will appear by default. This query was based on an experimental query by @jorgectf.The query “CSRF protection weakened or disabled” (
py/csrf-protection-disabled) has been implemented. Its results will now appear by default.
Query Metadata Changes¶
Java/Kotlin¶
Query
java/predictable-seednow has a tag for CWE-337.
Language Libraries¶
Bug Fixes¶
Ruby¶
The Tree-sitter Ruby grammar has been updated; this fixes several issues where Ruby code was parsed incorrectly.
Breaking Changes¶
Python¶
The imports made available from
import pythonare no longer exposed underDataFlow::after doingimport semmle.python.dataflow.new.DataFlow, for example usingDataFlow::Addwill now cause a compile error.
Minor Analysis Improvements¶
Java/Kotlin¶
Added models for the libraries OkHttp and Retrofit.
Add taint models for the following
Filemethods:File::getAbsoluteFileFile::getCanonicalFileFile::getAbsolutePathFile::getCanonicalPath
Added a flow step for
toStringcalls on taintedandroid.text.Editableobjects.Added a data flow step for tainted Android intents that are sent to other activities and accessed there via
getIntent().Added modeling of MyBatis (
org.apache.ibatis) Providers, resulting in additional sinks for the queriesjava/ognl-injection,java/sql-injection,java/sql-injection-localandjava/concatenated-sql-query.
JavaScript/TypeScript¶
The cash library is now modelled as an alias for JQuery.
Sinks and sources from cash should now be handled by all XSS queries.
Added the
Selectionapi as a DOM text source in thejs/xss-through-domquery.The security queries now recognize drag and drop data as a source, enabling the queries to flag additional alerts.
The security queries now recognize ClipboardEvent function parameters as a source, enabling the queries to flag additional alerts.
Python¶
The modeling of
request.filesin Flask has been fixed, so we now properly handle assignments to local variables (such asfiles = request.files; files['key'].filename).Added taint propagation for
io.StringIOandio.BytesIO. This addition was originally submitted as part of an experimental query by @jorgectf.
Deprecated APIs¶
JavaScript/TypeScript¶
The
ReflectedXss,StoredXss,XssThroughDom, andExceptionXssmodules fromXss.qllhave been deprecated.Use the
Customizations.qllfile belonging to the query instead.
New Features¶
Java/Kotlin¶
A number of new classes and methods related to the upcoming Kotlin support have been added. These are not yet stable, as Kotlin support is still under development.
File::isSourceFileFile::isJavaSourceFileFile::isKotlinSourceFileMember::getKotlinTypeElement::isCompilerGeneratedExpr::getKotlinTypeLambdaExpr::isKotlinFunctionNCallable::getReturnKotlinTypeCallable::getParameterKotlinTypeMethod::isLocalMethod::getKotlinNameField::getKotlinTypeModifiable::isSealedKotlinModifiable::isInternalVariable::getKotlinTypeLocalVariableDecl::getKotlinTypeParameter::getKotlinTypeParameter::isExtensionParameterCompilationclassDiagnosticclassKtInitializerAssignExprclassValueEQExprclassValueNEExprclassValueOrReferenceEqualsExprclassValueOrReferenceNotEqualsExprclassReferenceEqualityTestclassCastingExprclassSafeCastExprclassImplicitCastExprclassImplicitNotNullExprclassImplicitCoercionToUnitExprclassUnsafeCoerceExprclassPropertyRefExprclassNotInstanceOfExprclassExtensionReceiverAccessclassWhenExprclassWhenBranchclassClassExprclassStmtExprclassStringTemplateExprclassNotNullExprclassTypeNullPointerExceptionclassKtCommentclassKtCommentSectionclassKotlinTypeclassKotlinNullableTypeclassKotlinNotnullTypeclassKotlinTypeAliasclassPropertyclassDelegatedPropertyclassExtensionMethodclassKtInitializerNodeclassKtLoopStmtclassKtBreakContinueStmtclassKtBreakStmtclassKtContinueStmtclassClassObjectclassCompanionObjectclassLiveLiteralclassLiveLiteralMethodclassCastConversionContextrenamed toCastingConversionContext
The QL class
ValueDiscardingExprhas been added, representing expressions for which the value of the expression as a whole is discarded.