diff --git a/cpp/ql/src/CHANGELOG.md b/cpp/ql/src/CHANGELOG.md index 80b9ad0e475..e677f584416 100644 --- a/cpp/ql/src/CHANGELOG.md +++ b/cpp/ql/src/CHANGELOG.md @@ -7,7 +7,7 @@ * The "Multiplication result converted to larger type" (`cpp/integer-multiplication-cast-to-long`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. * The "Suspicious add with sizeof" (`cpp/suspicious-add-sizeof`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. * The "Wrong type of arguments to formatting function" (`cpp/wrong-type-format-argument`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. -* The "Implicit function declaration" (`cpp/implicit-function-declaration`) query has been upgraded to `high` precision. However, for `build mode: none` databases, it no longer produces any results. The results in this mode were found to be very noisy and fundamentally imprecise. +* The "Implicit function declaration" (`cpp/implicit-function-declaration`) query has been upgraded to `high` precision. However, for `build-mode: none` databases, it no longer produces any results. The results in this mode were found to be very noisy and fundamentally imprecise. ## 1.6.0 diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.qhelp b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.qhelp index 90a98e1bf57..d6c612abc75 100644 --- a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.qhelp +++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.qhelp @@ -14,7 +14,7 @@ function may behave unpredictably.

This may indicate a misspelled function name, or that the required header containing the function declaration has not been included.

-

Note: This query is not compatible with build mode: none databases, and produces +

Note: This query is not compatible with build-mode: none databases, and produces no results on those databases.

diff --git a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql index 00b29efbd0f..8e921faf211 100644 --- a/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql +++ b/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql @@ -18,7 +18,7 @@ import TooManyArguments import semmle.code.cpp.commons.Exclusions /* - * This query is not compatible with build mode: none databases, and produces + * This query is not compatible with build-mode: none databases, and produces * no results on those databases. */ diff --git a/cpp/ql/src/change-notes/released/1.6.1.md b/cpp/ql/src/change-notes/released/1.6.1.md index 83781b87c58..02ca1c2cd06 100644 --- a/cpp/ql/src/change-notes/released/1.6.1.md +++ b/cpp/ql/src/change-notes/released/1.6.1.md @@ -7,4 +7,4 @@ * The "Multiplication result converted to larger type" (`cpp/integer-multiplication-cast-to-long`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. * The "Suspicious add with sizeof" (`cpp/suspicious-add-sizeof`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. * The "Wrong type of arguments to formatting function" (`cpp/wrong-type-format-argument`) query has been upgraded to `high` precision. This query will now run in the default code scanning suite. -* The "Implicit function declaration" (`cpp/implicit-function-declaration`) query has been upgraded to `high` precision. However, for `build mode: none` databases, it no longer produces any results. The results in this mode were found to be very noisy and fundamentally imprecise. +* The "Implicit function declaration" (`cpp/implicit-function-declaration`) query has been upgraded to `high` precision. However, for `build-mode: none` databases, it no longer produces any results. The results in this mode were found to be very noisy and fundamentally imprecise. diff --git a/csharp/ql/lib/CHANGELOG.md b/csharp/ql/lib/CHANGELOG.md index 32cd8f33c65..2e3f6c137ee 100644 --- a/csharp/ql/lib/CHANGELOG.md +++ b/csharp/ql/lib/CHANGELOG.md @@ -64,9 +64,9 @@ No user-facing changes. * When a code-scanning configuration specifies the `paths:` and/or `paths-ignore:` settings, these are now taken into account by the C# extractor's search for `.config`, `.props`, XML and project files. * Updated the generated .NET “models as data” runtime models to cover .NET 10. * C# 14: Support for *implicit* span conversions in the QL library. -* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and `build mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. +* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and `build-mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. * Added autobuilder and `build-mode: none` support for `.slnx` solution files. -* In `build mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. +* In `build-mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. * Added implicit reads of `System.Collections.Generic.KeyValuePair.Value` at taint-tracking sinks and at inputs to additional taint steps. As a result, taint-tracking queries will now produce more results when a container is tainted. ### Bug Fixes diff --git a/csharp/ql/lib/change-notes/released/5.4.5.md b/csharp/ql/lib/change-notes/released/5.4.5.md index a084df5f200..fc1e8b8c4ee 100644 --- a/csharp/ql/lib/change-notes/released/5.4.5.md +++ b/csharp/ql/lib/change-notes/released/5.4.5.md @@ -5,9 +5,9 @@ * When a code-scanning configuration specifies the `paths:` and/or `paths-ignore:` settings, these are now taken into account by the C# extractor's search for `.config`, `.props`, XML and project files. * Updated the generated .NET “models as data” runtime models to cover .NET 10. * C# 14: Support for *implicit* span conversions in the QL library. -* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and `build mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. +* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and `build-mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. * Added autobuilder and `build-mode: none` support for `.slnx` solution files. -* In `build mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. +* In `build-mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. * Added implicit reads of `System.Collections.Generic.KeyValuePair.Value` at taint-tracking sinks and at inputs to additional taint steps. As a result, taint-tracking queries will now produce more results when a container is tainted. ### Bug Fixes diff --git a/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.24.0.rst b/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.24.0.rst index 9c228de1fc2..39b5ce0772d 100644 --- a/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.24.0.rst +++ b/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.24.0.rst @@ -152,9 +152,9 @@ C# * When a code-scanning configuration specifies the :code:`paths:` and/or :code:`paths-ignore:` settings, these are now taken into account by the C# extractor's search for :code:`.config`, :code:`.props`, XML and project files. * Updated the generated .NET “models as data” runtime models to cover .NET 10. * C# 14: Support for *implicit* span conversions in the QL library. -* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and :code:`build mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. +* Basic extractor support for .NET 10 is now available. Extraction is supported for .NET 10 projects in both traced mode and :code:`build-mode: none`. However, code that uses language features new to C# 14 is not yet fully supported for extraction and analysis. * Added autobuilder and :code:`build-mode: none` support for :code:`.slnx` solution files. -* In :code:`build mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. +* In :code:`build-mode: none`, .NET 10 is now used by default unless a specific .NET version is specified elsewhere. * Added implicit reads of :code:`System.Collections.Generic.KeyValuePair.Value` at taint-tracking sinks and at inputs to additional taint steps. As a result, taint-tracking queries will now produce more results when a container is tainted. Golang diff --git a/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.25.3.rst b/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.25.3.rst new file mode 100644 index 00000000000..88130515732 --- /dev/null +++ b/docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.25.3.rst @@ -0,0 +1,124 @@ +.. _codeql-cli-2.25.3: + +========================== +CodeQL 2.25.3 (2026-05-01) +========================== + +.. contents:: Contents + :depth: 2 + :local: + :backlinks: none + +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.25.3 runs a total of 496 security queries when configured with the Default suite (covering 169 CWE). The Extended suite enables an additional 131 queries (covering 32 more CWE). + +CodeQL CLI +---------- + +Improvements +~~~~~~~~~~~~ + +* The :code:`codeql database finalize` command now accepts the :code:`--working-dir` flag. When specified, any extractor pre-finalize scripts will be run in that directory. If the flag is not used, the scripts will run in the source root directory (maintaining existing behavior). The flag will also be automatically passed through when running the higher-level + :code:`codeql database create` command. + +Query Packs +----------- + +Major Analysis Improvements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +GitHub Actions +"""""""""""""" + +* Fixed alert messages in :code:`actions/artifact-poisoning/critical` and :code:`actions/artifact-poisoning/medium` as they previously included a redundant placeholder in the alert message that would on occasion contain a long block of yml that makes the alert difficult to understand. Also improved the wording to make it clearer that it is not the artifact that is being poisoned, but instead a potentially untrusted artifact that is consumed. Finally, changed the alert location to be the source, to align more with other queries reporting an artifact (e.g. zipslip) which is more useful. + +Minor Analysis Improvements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +C/C++ +""""" + +* Added :code:`AllocationFunction` models for :code:`aligned_alloc`, :code:`std::aligned_alloc`, and :code:`bsl::aligned_alloc`. +* The "Comparison of narrow type with wide type in loop condition" (:code:`cpp/comparison-with-wider-type`) query has been upgraded to :code:`high` precision. This query will now run in the default code scanning suite. +* The "Multiplication result converted to larger type" (:code:`cpp/integer-multiplication-cast-to-long`) query has been upgraded to :code:`high` precision. This query will now run in the default code scanning suite. +* The "Suspicious add with sizeof" (:code:`cpp/suspicious-add-sizeof`) query has been upgraded to :code:`high` precision. This query will now run in the default code scanning suite. +* The "Wrong type of arguments to formatting function" (:code:`cpp/wrong-type-format-argument`) query has been upgraded to :code:`high` precision. This query will now run in the default code scanning suite. +* The "Implicit function declaration" (:code:`cpp/implicit-function-declaration`) query has been upgraded to :code:`high` precision. However, for :code:`build-mode: none` databases, it no longer produces any results. The results in this mode were found to be very noisy and fundamentally imprecise. + +C# +"" + +* The query :code:`cs/useless-tostring-call` has been updated to avoid false positive results in calls to :code:`StringBuilder.AppendLine` and calls of the form :code:`base.ToString()`. Moreover, the alert message has been made more precise. + +JavaScript/TypeScript +""""""""""""""""""""" + +* The query :code:`js/missing-rate-limiting` now takes Fastify per-route rate limiting into account. + +Python +"""""" + +* The :code:`py/bind-socket-all-network-interfaces` query now uses the global data-flow library, leading to better precision and more results. Also, wrappers of :code:`socket.socket` in the :code:`eventlet` and :code:`gevent` libraries are now also recognized as socket binding operations. + +GitHub Actions +"""""""""""""" + +* The query :code:`actions/missing-workflow-permissions` no longer produces false positive results on reusable workflows where all callers set permissions. + +Language Libraries +------------------ + +Breaking Changes +~~~~~~~~~~~~~~~~ + +C/C++ +""""" + +* The deprecated :code:`NonThrowingFunction` class has been removed, use :code:`NonCppThrowingFunction` instead. +* The deprecated :code:`ThrowingFunction` class has been removed, use :code:`AlwaysSehThrowingFunction` instead. + +Major Analysis Improvements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Swift +""""" + +* Upgraded to allow analysis of Swift 6.3. + +Minor Analysis Improvements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Java/Kotlin +""""""""""" + +* The queries "Resolving XML external entity in user-controlled data" (:code:`java/xxe`) and "Resolving XML external entity in user-controlled data from local source" (:code:`java/xxe-local`) now recognize sinks in the Woodstox StAX library when :code:`com.ctc.wstx.stax.WstxInputFactory` or :code:`org.codehaus.stax2.XMLInputFactory2` are used directly. + +Python +"""""" + +* The Python extractor now supports the new :code:`lazy import ...` and :code:`lazy from ... import ...` (as defined in `PEP-810 `__) that will be part of Python 3.15. + +GitHub Actions +"""""""""""""" + +* Removed false positive injection sink models for the :code:`context` input of :code:`docker/build-push-action` and the :code:`allowed-endpoints` input of :code:`step-security/harden-runner`. + +Deprecated APIs +~~~~~~~~~~~~~~~ + +C# +"" + +* The predicates :code:`get[L|R]Value` in the class :code:`Assignment` have been deprecated. Use :code:`get[Left|Right]Operand` instead. + +New Features +~~~~~~~~~~~~ + +C/C++ +""""" + +* Added a subclass :code:`AutoconfConfigureTestFile` of :code:`ConfigurationTestFile` that represents files created by GNU autoconf configure scripts to test the build configuration. diff --git a/docs/codeql/codeql-overview/codeql-changelog/index.rst b/docs/codeql/codeql-overview/codeql-changelog/index.rst index 32a8b4574bb..5835176a93f 100644 --- a/docs/codeql/codeql-overview/codeql-changelog/index.rst +++ b/docs/codeql/codeql-overview/codeql-changelog/index.rst @@ -11,6 +11,7 @@ A list of queries for each suite and language `is available here ; - -/** - * A taint-tracking configuration to reason about arithmetic underflow using local-user-controlled data. - */ -deprecated module ArithmeticTaintedLocalUnderflowConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { underflowSink(_, sink.asExpr()) } - - predicate isBarrier(DataFlow::Node n) { underflowBarrier(n) } - - predicate isBarrierIn(DataFlow::Node node) { isSource(node) } -} - -/** - * DEPRECATED: Use `ArithmeticUnderflow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for arithmetic underflow using local-user-controlled data. - */ -deprecated module ArithmeticTaintedLocalUnderflowFlow = - TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/ArithmeticTaintedQuery.qll b/java/ql/lib/semmle/code/java/security/ArithmeticTaintedQuery.qll index 65e73f84149..9d123b379cd 100644 --- a/java/ql/lib/semmle/code/java/security/ArithmeticTaintedQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ArithmeticTaintedQuery.qll @@ -25,11 +25,6 @@ module ArithmeticOverflowConfig implements DataFlow::ConfigSig { } } -/** - * DEPRECATED: Use `ArithmeticOverflowConfig` instead. - */ -deprecated module RemoteUserInputOverflowConfig = ArithmeticOverflowConfig; - /** A taint-tracking configuration to reason about underflow from unvalidated input. */ module ArithmeticUnderflowConfig implements DataFlow::ConfigSig { predicate isSource(DataFlow::Node source) { source instanceof ActiveThreatModelSource } @@ -51,23 +46,8 @@ module ArithmeticUnderflowConfig implements DataFlow::ConfigSig { } } -/** - * DEPRECATED: Use `ArithmeticUnderflowConfig` instead. - */ -deprecated module RemoteUserInputUnderflowConfig = ArithmeticUnderflowConfig; - /** Taint-tracking flow for overflow from unvalidated input. */ module ArithmeticOverflow = TaintTracking::Global; -/** - * DEPRECATED: Use `ArithmeticOverflow` instead. - */ -deprecated module RemoteUserInputOverflow = ArithmeticOverflow; - /** Taint-tracking flow for underflow from unvalidated input. */ module ArithmeticUnderflow = TaintTracking::Global; - -/** - * DEPRECATED: Use `ArithmeticUnderflow` instead. - */ -deprecated module RemoteUserInputUnderflow = ArithmeticUnderflow; diff --git a/java/ql/lib/semmle/code/java/security/CommandLineQuery.qll b/java/ql/lib/semmle/code/java/security/CommandLineQuery.qll index 273c5360b81..9aa62d950c5 100644 --- a/java/ql/lib/semmle/code/java/security/CommandLineQuery.qll +++ b/java/ql/lib/semmle/code/java/security/CommandLineQuery.qll @@ -78,44 +78,11 @@ module InputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { } } -/** - * DEPRECATED: Use `InputToArgumentToExecFlowConfig` instead. - */ -deprecated module RemoteUserInputToArgumentToExecFlowConfig = InputToArgumentToExecFlowConfig; - /** * Taint-tracking flow for unvalidated input that is used to run an external process. */ module InputToArgumentToExecFlow = TaintTracking::Global; -/** - * DEPRECATED: Use `InputToArgumentToExecFlow` instead. - */ -deprecated module RemoteUserInputToArgumentToExecFlow = InputToArgumentToExecFlow; - -/** - * A taint-tracking configuration for unvalidated local user input that is used to run an external process. - */ -deprecated module LocalUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink } - - predicate isBarrier(DataFlow::Node node) { node instanceof CommandInjectionSanitizer } - - predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) { - any(CommandInjectionAdditionalTaintStep s).step(n1, n2) - } -} - -/** - * DEPRECATED: Use `InputToArgumentToExecFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for unvalidated local user input that is used to run an external process. - */ -deprecated module LocalUserInputToArgumentToExecFlow = - TaintTracking::Global; - /** * Implementation of `ExecTainted.ql`. It is extracted to a QLL * so that it can be excluded from `ExecUnescaped.ql` to avoid diff --git a/java/ql/lib/semmle/code/java/security/ExecTaintedLocalQuery.qll b/java/ql/lib/semmle/code/java/security/ExecTaintedLocalQuery.qll index 7a2d5b0947d..dfc727e89d7 100644 --- a/java/ql/lib/semmle/code/java/security/ExecTaintedLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ExecTaintedLocalQuery.qll @@ -1,27 +1,5 @@ /** Provides a taint-tracking configuration to reason about use of externally controlled strings for command injection vulnerabilities. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.security.ExternalProcess -private import semmle.code.java.security.CommandArguments -private import semmle.code.java.security.Sanitizers - -/** A taint-tracking configuration to reason about use of externally controlled strings to make command line commands. */ -deprecated module ExecTaintedLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink.asExpr() instanceof ArgumentToExec } - - predicate isBarrier(DataFlow::Node node) { - node instanceof SimpleTypeSanitizer - or - isSafeCommandArgument(node.asExpr()) - } -} - -/** - * DEPRCATED: Unused. - * - * Taint-tracking flow for use of externally controlled strings to make command line commands. - */ -deprecated module ExecTaintedLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringLocalQuery.qll b/java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringLocalQuery.qll index 482673bacc9..79cf2a300f4 100644 --- a/java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringLocalQuery.qll @@ -1,26 +1,5 @@ /** Provides a taint-tracking configuration to reason about externally-controlled format strings from local sources. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.StringFormat - -/** A taint-tracking configuration to reason about externally-controlled format strings from local sources. */ -deprecated module ExternallyControlledFormatStringLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { - sink.asExpr() = any(StringFormat formatCall).getFormatArgument() - } - - predicate isBarrier(DataFlow::Node node) { - node.getType() instanceof NumericType or node.getType() instanceof BooleanType - } -} - -/** - * DEPRECATED: Use `ExternallyControlledFormatStringFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for externally-controlled format strings from local sources. - */ -deprecated module ExternallyControlledFormatStringLocalFlow = - TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayConstructionLocalQuery.qll b/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayConstructionLocalQuery.qll index 1d31d7afb87..e5b51c2ae53 100644 --- a/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayConstructionLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayConstructionLocalQuery.qll @@ -1,24 +1,5 @@ /** Provides a taint-tracking configuration to reason about improper validation of local user-provided size used for array construction. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.security.internal.ArraySizing -private import semmle.code.java.dataflow.FlowSources - -/** - * A taint-tracking configuration to reason about improper validation of local user-provided size used for array construction. - */ -deprecated module ImproperValidationOfArrayConstructionLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { - any(CheckableArrayAccess caa).canThrowOutOfBoundsDueToEmptyArray(sink.asExpr(), _) - } -} - -/** - * DEPRECATED: Use `ImproperValidationOfArrayConstructionFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for improper validation of local user-provided size used for array construction. - */ -deprecated module ImproperValidationOfArrayConstructionLocalFlow = - TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayIndexLocalQuery.qll b/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayIndexLocalQuery.qll index 5f1e7c81e01..b6b1366fb40 100644 --- a/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayIndexLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayIndexLocalQuery.qll @@ -1,28 +1,5 @@ /** Provides a taint-tracking configuration to reason about improper validation of local user-provided array index. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.security.internal.ArraySizing -private import semmle.code.java.dataflow.FlowSources - -/** - * A taint-tracking configuration to reason about improper validation of local user-provided array index. - */ -deprecated module ImproperValidationOfArrayIndexLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { - any(CheckableArrayAccess caa).canThrowOutOfBounds(sink.asExpr()) - } - - predicate isBarrier(DataFlow::Node node) { node.getType() instanceof BooleanType } - - predicate isBarrierIn(DataFlow::Node node) { isSource(node) } -} - -/** - * DEPRECATED: Use `ImproperValidationOfArrayIndexFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for improper validation of local user-provided array index. - */ -deprecated module ImproperValidationOfArrayIndexLocalFlow = - TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/NumericCastTaintedQuery.qll b/java/ql/lib/semmle/code/java/security/NumericCastTaintedQuery.qll index 793871a4bd2..a4c3785feea 100644 --- a/java/ql/lib/semmle/code/java/security/NumericCastTaintedQuery.qll +++ b/java/ql/lib/semmle/code/java/security/NumericCastTaintedQuery.qll @@ -115,34 +115,3 @@ module NumericCastFlowConfig implements DataFlow::ConfigSig { * Taint-tracking flow for user input that is used in a numeric cast. */ module NumericCastFlow = TaintTracking::Global; - -/** - * A taint-tracking configuration for reasoning about local user input that is - * used in a numeric cast. - */ -deprecated module NumericCastLocalFlowConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { - sink.asExpr() = any(NumericNarrowingCastExpr cast).getExpr() and - sink.asExpr() instanceof VarAccess - } - - predicate isBarrier(DataFlow::Node node) { - boundedRead(node.asExpr()) or - castCheck(node.asExpr()) or - node.getType() instanceof SmallType or - smallExpr(node.asExpr()) or - node.getEnclosingCallable() instanceof HashCodeMethod or - exists(RightShiftOp e | e.getShiftedVariable().getAnAccess() = node.asExpr()) - } - - predicate isBarrierIn(DataFlow::Node node) { isSource(node) } -} - -/** - * DEPRECATED: Use `NumericCastFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for local user input that is used in a numeric cast. - */ -deprecated module NumericCastLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll b/java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll index e5845b630ec..e0383cd52d9 100644 --- a/java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll @@ -1,39 +1,5 @@ /** Provides a taint-tracking configuration to reason about response splitting vulnerabilities from local user input. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.security.ResponseSplitting - -/** - * A taint-tracking configuration to reason about response splitting vulnerabilities from local user input. - */ -deprecated module ResponseSplittingLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink } - - predicate isBarrier(DataFlow::Node node) { - node.getType() instanceof PrimitiveType - or - node.getType() instanceof BoxedType - or - exists(MethodCall ma, string methodName, CompileTimeConstantExpr target | - node.asExpr() = ma and - ma.getMethod().hasQualifiedName("java.lang", "String", methodName) and - target = ma.getArgument(0) and - ( - methodName = "replace" and target.getIntValue() = [10, 13] // 10 == "\n", 13 == "\r" - or - methodName = "replaceAll" and - target.getStringValue().regexpMatch(".*([\n\r]|\\[\\^[^\\]\r\n]*\\]).*") - ) - ) - } -} - -/** - * DEPRECATED: Use `ResponseSplittingFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for response splitting vulnerabilities from local user input. - */ -deprecated module ResponseSplittingLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/SqlTaintedLocalQuery.qll b/java/ql/lib/semmle/code/java/security/SqlTaintedLocalQuery.qll index 7ff4b300ce8..80cd491acf2 100644 --- a/java/ql/lib/semmle/code/java/security/SqlTaintedLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/SqlTaintedLocalQuery.qll @@ -2,32 +2,7 @@ * Provides a taint-tracking configuration for reasoning about local user input * that is used in a SQL query. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.security.SqlInjectionQuery -private import semmle.code.java.security.Sanitizers - -/** - * A taint-tracking configuration for reasoning about local user input that is - * used in a SQL query. - */ -deprecated module LocalUserInputToQueryInjectionFlowConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof QueryInjectionSink } - - predicate isBarrier(DataFlow::Node node) { node instanceof SimpleTypeSanitizer } - - predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) { - any(AdditionalQueryInjectionTaintStep s).step(node1, node2) - } -} - -/** - * DEPRECATED: Use `QueryInjectionFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for local user input that is used in a SQL query. - */ -deprecated module LocalUserInputToQueryInjectionFlow = - TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/TaintedPathQuery.qll b/java/ql/lib/semmle/code/java/security/TaintedPathQuery.qll index cb04f39101c..64304e6c2b0 100644 --- a/java/ql/lib/semmle/code/java/security/TaintedPathQuery.qll +++ b/java/ql/lib/semmle/code/java/security/TaintedPathQuery.qll @@ -78,28 +78,3 @@ module TaintedPathConfig implements DataFlow::ConfigSig { /** Tracks flow from remote sources to the creation of a path. */ module TaintedPathFlow = TaintTracking::Global; - -/** - * A taint-tracking configuration for tracking flow from local user input to the creation of a path. - */ -deprecated module TaintedPathLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof TaintedPathSink } - - predicate isBarrier(DataFlow::Node sanitizer) { - sanitizer instanceof SimpleTypeSanitizer or - sanitizer instanceof PathInjectionSanitizer - } - - predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) { - any(TaintedPathAdditionalTaintStep s).step(n1, n2) - } -} - -/** - * DEPRECATED: Use `TaintedPathFlow` instead and configure threat model sources to include `local`. - * - * Tracks flow from local user input to the creation of a path. - */ -deprecated module TaintedPathLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/UrlRedirectLocalQuery.qll b/java/ql/lib/semmle/code/java/security/UrlRedirectLocalQuery.qll index f68fb959ea5..2016e9be14f 100644 --- a/java/ql/lib/semmle/code/java/security/UrlRedirectLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/UrlRedirectLocalQuery.qll @@ -1,21 +1,5 @@ /** Provides a taint-tracking configuration to reason about URL redirection from local sources. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.security.UrlRedirect - -/** - * A taint-tracking configuration to reason about URL redirection from local sources. - */ -deprecated module UrlRedirectLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof UrlRedirectSink } -} - -/** - * DEPRECATED: Use `UrlRedirectFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for URL redirection from local sources. - */ -deprecated module UrlRedirectLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/XssLocalQuery.qll b/java/ql/lib/semmle/code/java/security/XssLocalQuery.qll index 5e1098865aa..fd8fd6f451c 100644 --- a/java/ql/lib/semmle/code/java/security/XssLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/XssLocalQuery.qll @@ -1,30 +1,5 @@ /** Provides a taint-tracking configuration to reason about cross-site scripting from a local source. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.dataflow.TaintTracking -private import semmle.code.java.security.XSS - -/** - * A taint-tracking configuration for reasoning about cross-site scripting vulnerabilities from a local source. - */ -deprecated module XssLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof XssSink } - - predicate isBarrier(DataFlow::Node node) { node instanceof XssSanitizer } - - predicate isBarrierOut(DataFlow::Node node) { node instanceof XssSinkBarrier } - - predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) { - any(XssAdditionalTaintStep s).step(node1, node2) - } -} - -/** - * DEPRECATED: Use `XssFlow` instead and configure threat model sources to include `local`. - * - * Taint-tracking flow for cross-site scripting vulnerabilities from a local source. - */ -deprecated module XssLocalFlow = TaintTracking::Global; diff --git a/java/ql/lib/semmle/code/java/security/XxeLocalQuery.qll b/java/ql/lib/semmle/code/java/security/XxeLocalQuery.qll index f485137fc78..c45cd560cfc 100644 --- a/java/ql/lib/semmle/code/java/security/XxeLocalQuery.qll +++ b/java/ql/lib/semmle/code/java/security/XxeLocalQuery.qll @@ -1,28 +1,5 @@ /** Provides taint tracking configurations to be used in local XXE queries. */ +overlay[local?] +deprecated module; import java -private import semmle.code.java.dataflow.FlowSources -private import semmle.code.java.dataflow.TaintTracking -private import semmle.code.java.security.XxeQuery - -/** - * A taint-tracking configuration for unvalidated local user input that is used in XML external entity expansion. - */ -deprecated module XxeLocalConfig implements DataFlow::ConfigSig { - predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } - - predicate isSink(DataFlow::Node sink) { sink instanceof XxeSink } - - predicate isBarrier(DataFlow::Node sanitizer) { sanitizer instanceof XxeSanitizer } - - predicate isAdditionalFlowStep(DataFlow::Node n1, DataFlow::Node n2) { - any(XxeAdditionalTaintStep s).step(n1, n2) - } -} - -/** - * DEPRECATED: Use `XxeFlow` instead and configure threat model sources to include `local`. - * - * Detect taint flow of unvalidated local user input that is used in XML external entity expansion. - */ -deprecated module XxeLocalFlow = TaintTracking::Global; diff --git a/java/ql/src/experimental/Security/CWE/CWE-094/SpringImplicitViewManipulation.ql b/java/ql/src/experimental/Security/CWE/CWE-094/SpringImplicitViewManipulation.ql index faef29d1fde..52b333de6d7 100644 --- a/java/ql/src/experimental/Security/CWE/CWE-094/SpringImplicitViewManipulation.ql +++ b/java/ql/src/experimental/Security/CWE/CWE-094/SpringImplicitViewManipulation.ql @@ -43,7 +43,7 @@ deprecated private predicate mayBeExploitable(Method m) { // hence, here we check for the param type to be a Java `String`. p.getType() instanceof TypeString and // Exclude cases where a regex check is applied on a parameter to prevent false positives. - not m.(SpringRequestMappingMethod).getValue().matches("%{%:[%]%}%") + not m.(SpringRequestMappingMethod).getAValue().matches("%{%:[%]%}%") ) and not maybeATestMethod(m) } diff --git a/java/ql/src/semmle/code/xml/MyBatisMapperXML.qll b/java/ql/src/semmle/code/xml/MyBatisMapperXML.qll deleted file mode 100644 index 5d047f1e82a..00000000000 --- a/java/ql/src/semmle/code/xml/MyBatisMapperXML.qll +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Provides classes for working with MyBatis mapper xml files and their content. - */ -deprecated module; - -import java - -/** - * MyBatis Mapper XML file. - */ -class MyBatisMapperXmlFile extends XmlFile { - MyBatisMapperXmlFile() { - count(XmlElement e | e = this.getAChild()) = 1 and - this.getAChild().getName() = "mapper" - } -} - -/** - * An XML element in a `MyBatisMapperXMLFile`. - */ -class MyBatisMapperXmlElement extends XmlElement { - MyBatisMapperXmlElement() { this.getFile() instanceof MyBatisMapperXmlFile } - - /** - * Gets the value for this element, with leading and trailing whitespace trimmed. - */ - string getValue() { result = this.allCharactersString().trim() } - - /** - * Gets the reference type bound to MyBatis Mapper XML File. - */ - RefType getNamespaceRefType() { - result.getQualifiedName() = this.getAttribute("namespace").getValue() - } -} - -/** - * An MyBatis Mapper sql operation element. - */ -abstract class MyBatisMapperSqlOperation extends MyBatisMapperXmlElement { - /** - * Gets the value of the `id` attribute of MyBatis Mapper sql operation element. - */ - string getId() { result = this.getAttribute("id").getValue() } - - /** - * Gets the `` element in a `MyBatisMapperSqlOperation`. - */ - MyBatisMapperInclude getInclude() { result = this.getAChild*() } - - /** - * Gets the method bound to MyBatis Mapper XML File. - */ - Method getMapperMethod() { - result.getName() = this.getId() and - result.getDeclaringType() = this.getParent().(MyBatisMapperXmlElement).getNamespaceRefType() - } -} - -/** - * A `` element in a `MyBatisMapperSqlOperation`. - */ -class MyBatisMapperInsert extends MyBatisMapperSqlOperation { - MyBatisMapperInsert() { this.getName() = "insert" } -} - -/** - * A `` element in a `MyBatisMapperSqlOperation`. - */ -class MyBatisMapperUpdate extends MyBatisMapperSqlOperation { - MyBatisMapperUpdate() { this.getName() = "update" } -} - -/** - * A `` element in a `MyBatisMapperSqlOperation`. - */ -class MyBatisMapperDelete extends MyBatisMapperSqlOperation { - MyBatisMapperDelete() { this.getName() = "delete" } -} - -/** - * A `