CodeQL 2.22.1 (2025-06-26)¶
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.22.1 runs a total of 476 security queries when configured with the Default suite (covering 166 CWE). The Extended suite enables an additional 129 queries (covering 32 more CWE). 27 security queries have been added with this release.
CodeQL CLI¶
New Features¶
Rust language support is now in public preview.
Miscellaneous¶
The version of
jgitused by the CodeQL CLI has been updated to6.10.1.202505221210-r.
Query Packs¶
Minor Analysis Improvements¶
C/C++¶
Added flow models for the following libraries:
madler/zlib,google/brotli,libidn/libidn2,libssh2/libssh2,nghttp2/nghttp2,libuv/libuv, andcurl/curl. This may result in more alerts when running queries on codebases that use these libraries.
C#¶
The queries
cs/dereferenced-value-is-always-nullandcs/dereferenced-value-may-be-nullhave been improved to reduce false positives. The queries no longer assume that expressions are dereferenced when passed as the receiver (thisparameter) to extension methods where that parameter is a nullable type.
JavaScript/TypeScript¶
The
js/loop-iteration-skipped-due-to-shiftingquery now has thereliabilitytag.Fixed false positives in the
js/loop-iteration-skipped-due-to-shiftingquery when the return value ofspliceis used to decide whether to adjust the loop counter.Fixed false positives in the
js/template-syntax-in-string-literalquery where template syntax in string concatenation and “manual string interpolation” patterns were incorrectly flagged.The
js/useless-expressionquery now correctly flags only the innermost expressions with no effect, avoiding duplicate alerts on compound expressions.
Python¶
The
py/iter-returns-non-selfquery has been modernized, and no longer alerts for certain cases where an equivalent iterator is returned.
New Queries¶
Rust¶
Initial public preview release.
Query Metadata Changes¶
C#¶
Query metadata tags have been systematically updated for many C# queries. Primary categorization as either
reliabilityormaintainability, and relevant sub-category tags such asreadability,useless-code,complexity,performance,correctness,error-handling, andconcurrency. Aligns with the established Query file metadata and alert message style guide.Adjusts the
@security-severityfrom 9.3 to 7.3 forcs/uncontrolled-format-stringto alignCWE-134severity for memory safe languages to better reflect their impact.
Golang¶
The tag
qualityhas been added to multiple Go quality queries for consistency. They have all been given a tag for one of the two top-level categoriesreliabilityormaintainability, and a tag for a sub-category. See Query file metadata and alert message style guide for more information about these categories.The tag
external/cwe/cwe-129has been added togo/constant-length-comparison.The tag
external/cwe/cwe-193has been added togo/index-out-of-bounds.The tag
external/cwe/cwe-197has been added togo/shift-out-of-range.The tag
external/cwe/cwe-248has been added togo/redundant-recover.The tag
external/cwe/cwe-252has been added togo/missing-error-checkandgo/unhandled-writable-file-close.The tag
external/cwe/cwe-480has been added togo/mistyped-exponentiation.The tag
external/cwe/cwe-570has been added togo/impossible-interface-nil-checkandgo/comparison-of-identical-expressions.The tag
external/cwe/cwe-571has been added togo/negative-length-checkandgo/comparison-of-identical-expressions.The tag
external/cwe/cwe-783has been added togo/whitespace-contradicts-precedence.The tag
external/cwe/cwe-835has been added togo/inconsistent-loop-direction.The tag
error-handlinghas been added togo/missing-error-check,go/unhandled-writable-file-close, andgo/unexpected-nil-value.The tag
useless-codehas been added togo/useless-assignment-to-field,go/useless-assignment-to-local,go/useless-expression, andgo/unreachable-statement.The tag
logichas been removed fromgo/index-out-of-boundsandgo/unexpected-nil-value.The tags
callanddeferhave been removed fromgo/unhandled-writable-file-close.The tags
correctnessandqualityhave been reordered ingo/missing-error-checkandgo/unhandled-writable-file-close.The tag
maintainabilityhas been changed toreliabilityforgo/unhandled-writable-file-close.The tag order has been standardized to have
qualityfirst, followed by the top-level category (reliabilityormaintainability), then sub-category tags, and finally CWE tags.The description text has been updated in
go/whitespace-contradicts-precedenceto change “may even indicate” to “may indicate”.
Java/Kotlin¶
The tag
qualityhas been added to multiple Java quality queries for consistency. They have all been given a tag for one of the two top-level categoriesreliabilityormaintainability, and a tag for a sub-category. See Query file metadata and alert message style guide for more information about these categories.The tag
external/cwe/cwe-571has been added tojava/equals-on-unrelated-types.The tag
readabilityhas been added tojava/missing-override-annotation,java/deprecated-call,java/inconsistent-javadoc-throws,java/unknown-javadoc-parameter,java/jdk-internal-api-access,java/underscore-identifier,java/misleading-indentation,java/inefficient-empty-string-test,java/non-static-nested-class,inefficient-string-constructor, andjava/constants-only-interface.The tag
useless-codehas been added tojava/useless-type-test, andjava/useless-tostring-call.The tag
complexityhas been added tojava/chained-type-tests, andjava/abstract-to-concrete-cast.The tag
error-handlinghas been added tojava/ignored-error-status-of-call, andjava/uncaught-number-format-exception.The tag
correctnesshas been added tojava/evaluation-to-constant,java/whitespace-contradicts-precedence,java/empty-container,java/string-buffer-char-init,java/call-to-object-tostring,java/print-arrayandjava/internal-representation-exposure.The tag
performancehas been added tojava/input-resource-leak,java/database-resource-leak,java/output-resource-leak,java/inefficient-key-set-iterator,java/inefficient-output-stream, andjava/inefficient-boxed-constructor.The tag
correctnesshas been removed fromjava/call-to-thread-run,java/unsafe-double-checked-locking,java/unsafe-double-checked-locking-init-order,java/non-sync-override,java/sync-on-boxed-types,java/unsynchronized-getter,java/input-resource-leak,java/output-resource-leak,java/database-resource-leak, andjava/ignored-error-status-of-call.The tags
maintainabilityhas been removed fromjava/string-buffer-char-init,java/inefficient-key-set-iterator,java/inefficient-boxed-constructor, andjava/internal-representation-exposure.The tags
reliabilityhas been removed fromjava/subtle-inherited-call,java/print-array, andjava/call-to-object-tostring.The tags
maintainabilityanduseless-codehave been removed fromjava/evaluation-to-constant.The tags
maintainabilityandreadabilityhave been removed fromjava/whitespace-contradicts-precedence.The tags
maintainabilityanduseless-codehave been removed fromjava/empty-container.Adjusts the
@precisionfrom high to medium forjava/concatenated-command-linebecause it is producing false positive alerts when the concatenated strings are hard-coded.Adjusts the
@security-severityfrom 9.3 to 7.3 forjava/tainted-format-stringto alignCWE-134severity for memory safe languages to better reflect their impact.
JavaScript/TypeScript¶
The
qualitytag has been added to multiple JavaScript quality queries, with tags forreliabilityormaintainabilitycategories and their sub-categories. See Query file metadata and alert message style guide for more information about these categories.Added
reliabilitytag to thejs/suspicious-method-name-declarationquery.Added
reliabilityandlanguage-featurestags to thejs/template-syntax-in-string-literalquery.
Python¶
The tag
qualityhas been added to multiple Python quality queries for consistency. They have all been given a tag for one of the two top-level categoriesreliabilityormaintainability, and a tag for a sub-category. See Query file metadata and alert message style guide for more information about these categories.
Ruby¶
Update query metadata tags for
rb/database-query-in-loopandrb/useless-assignment-to-localto align with the established Query file metadata and alert message style guide.
Swift¶
Adjusts the
@security-severityfrom 9.3 to 7.3 forswift/uncontrolled-format-stringto alignCWE-134severity for memory safe languages to better reflect their impact.
Language Libraries¶
Bug Fixes¶
C/C++¶
resolveTypedefsnow properly resolves typedefs forArrayTypes.
Minor Analysis Improvements¶
Java/Kotlin¶
Java
assertstatements are now assumed to be executed for the purpose of analysing control flow. This improves precision for a number of queries.
JavaScript/TypeScript¶
Calls to
sinon.match()are no longer incorrectly identified as regular expression operations.Improved data flow tracking through middleware to handle default value and similar patterns.
Added
req._parsedUrlas a remote input source.Improved taint tracking through calls to
serialize-javascript.Removed
encodeURIandescapefunctions from the sanitizer list for request forgery.The JavaScript extractor now skips generated JavaScript files if the original TypeScript files are already present. It also skips any files in the output directory specified in the
compilerOptionspart of thetsconfig.jsonfile.Added support for Axios instances in the
axiosmodule.
GitHub Actions¶
Fixed performance issues in the parsing of Bash scripts in workflow files, which led to out-of-disk errors when analysing certain workflow files with complex interpolations of shell commands or quoted strings.
Deprecated APIs¶
C/C++¶
The
ThrowingFunctionclass (semmle.code.cpp.models.interfaces.Throwing) has been deprecated. Please use theAlwaysSehThrowingFunctionclass instead.
New Features¶
C/C++¶
Added a predicate
getAnAttributetoNamespaceto retrieve a namespace attribute.The Microsoft-specific
__leavestatement is now supported.A new class
LeaveStmtextendingJumpStmtwas added to represent__leavestatements.Added a predicate
hasParameterListtoLambdaExpressionto capture whether a lambda has an explicitly specified parameter list.
Rust¶
Initial public preview release.