GeezerVison is showing github.com — Merge pull request #16362 from michaelnebel/java/removelocalqueries · github/codeql@b1329fd
File treeExpand file treeCollapse file tree Open diff view settings lib/semmle/code/java/security experimental/Security/CWE/CWE-078
test/query-tests/security
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: java/ql/automodel/src/AutomodelAlertSinkUtil.qll +1-5Lines changed: 1 addition & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -159,11 +159,7 @@ predicate sinkModelTallyPerQuery(string queryName, int alertCount, SinkModel sin | 159 | 159 | SinkTallier<RequestForgeryConfig>::getSinkModelCount(alertCount, sinkModel) | 160 | 160 | or | 161 | 161 | queryName = "java/command-line-injection" and | 162 | | - exists(int c1, int c2 | | 163 | | - SinkTallier<RemoteUserInputToArgumentToExecFlowConfig>::getSinkModelCount(c1, sinkModel) and | 164 | | - SinkTallier<LocalUserInputToArgumentToExecFlowConfig>::getSinkModelCount(c2, sinkModel) and | 165 | | - alertCount = c1 + c2 | 166 | | - ) | | 162 | + SinkTallier<InputToArgumentToExecFlowConfig>::getSinkModelCount(alertCount, sinkModel) | 167 | 163 | or | 168 | 164 | queryName = "java/concatenated-sql-query" and | 169 | 165 | SinkTallier<UncontrolledStringBuilderSourceFlowConfig>::getSinkModelCount(alertCount, sinkModel) | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ArithmeticTaintedLocalQuery.qll +10-4Lines changed: 10 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,9 +5,11 @@ private import semmle.code.java.dataflow.FlowSources | 5 | 5 | private import semmle.code.java.security.ArithmeticCommon | 6 | 6 |
| 7 | 7 | /** | | 8 | + * DEPRECATED: Use `ArithmeticOverflowConfig` instead. | | 9 | + * | 8 | 10 | * A taint-tracking configuration to reason about arithmetic overflow using local-user-controlled data. | 9 | 11 | */ | 10 | | -module ArithmeticTaintedLocalOverflowConfig implements DataFlow::ConfigSig { | | 12 | +deprecated module ArithmeticTaintedLocalOverflowConfig implements DataFlow::ConfigSig { | 11 | 13 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 12 | 14 |
| 13 | 15 | predicate isSink(DataFlow::Node sink) { overflowSink(_, sink.asExpr()) } | @@ -18,15 +20,17 @@ module ArithmeticTaintedLocalOverflowConfig implements DataFlow::ConfigSig { | 18 | 20 | } | 19 | 21 |
| 20 | 22 | /** | | 23 | + * DEPRECATED: Use `ArithmeticOverflow` instead and configure threat model sources to include `local`. | | 24 | + * | 21 | 25 | * Taint-tracking flow for arithmetic overflow using local-user-controlled data. | 22 | 26 | */ | 23 | | -module ArithmeticTaintedLocalOverflowFlow = | | 27 | +deprecated module ArithmeticTaintedLocalOverflowFlow = | 24 | 28 | TaintTracking::Global<ArithmeticTaintedLocalOverflowConfig>; | 25 | 29 |
| 26 | 30 | /** | 27 | 31 | * A taint-tracking configuration to reason about arithmetic underflow using local-user-controlled data. | 28 | 32 | */ | 29 | | -module ArithmeticTaintedLocalUnderflowConfig implements DataFlow::ConfigSig { | | 33 | +deprecated module ArithmeticTaintedLocalUnderflowConfig implements DataFlow::ConfigSig { | 30 | 34 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 31 | 35 |
| 32 | 36 | predicate isSink(DataFlow::Node sink) { underflowSink(_, sink.asExpr()) } | @@ -37,7 +41,9 @@ module ArithmeticTaintedLocalUnderflowConfig implements DataFlow::ConfigSig { | 37 | 41 | } | 38 | 42 |
| 39 | 43 | /** | | 44 | + * DEPRECATED: Use `ArithmeticUnderflow` instead and configure threat model sources to include `local`. | | 45 | + * | 40 | 46 | * Taint-tracking flow for arithmetic underflow using local-user-controlled data. | 41 | 47 | */ | 42 | | -module ArithmeticTaintedLocalUnderflowFlow = | | 48 | +deprecated module ArithmeticTaintedLocalUnderflowFlow = | 43 | 49 | TaintTracking::Global<ArithmeticTaintedLocalUnderflowConfig>; |
Collapse file Copy file name to clipboard +29-9Lines changed: 29 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -/** Provides taint-tracking configurations to reason about arithmetic with unvalidated user input. */ | | 1 | +/** Provides taint-tracking configurations to reason about arithmetic with unvalidated input. */ | 2 | 2 |
| 3 | 3 | import java | 4 | 4 | private import semmle.code.java.dataflow.FlowSources | 5 | 5 | private import semmle.code.java.security.ArithmeticCommon | 6 | 6 |
| 7 | | -/** A taint-tracking configuration to reason about overflow from unvalidated user input. */ | 8 | | -module RemoteUserInputOverflowConfig implements DataFlow::ConfigSig { | | 7 | +/** A taint-tracking configuration to reason about overflow from unvalidated input. */ | | 8 | +module ArithmeticOverflowConfig implements DataFlow::ConfigSig { | 9 | 9 | predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource } | 10 | 10 |
| 11 | 11 | predicate isSink(DataFlow::Node sink) { overflowSink(_, sink.asExpr()) } | @@ -15,8 +15,13 @@ module RemoteUserInputOverflowConfig implements DataFlow::ConfigSig { | 15 | 15 | predicate isBarrierIn(DataFlow::Node node) { isSource(node) } | 16 | 16 | } | 17 | 17 |
| 18 | | -/** A taint-tracking configuration to reason about underflow from unvalidated user input. */ | 19 | | -module RemoteUserInputUnderflowConfig implements DataFlow::ConfigSig { | | 18 | +/** | | 19 | + * DEPRECATED: Use `ArithmeticOverflowConfig` instead. | | 20 | + */ | | 21 | +deprecated module RemoteUserInputOverflowConfig = ArithmeticOverflowConfig; | | 22 | + | | 23 | +/** A taint-tracking configuration to reason about underflow from unvalidated input. */ | | 24 | +module ArithmeticUnderflowConfig implements DataFlow::ConfigSig { | 20 | 25 | predicate isSource(DataFlow::Node source) { source instanceof ThreatModelFlowSource } | 21 | 26 |
| 22 | 27 | predicate isSink(DataFlow::Node sink) { underflowSink(_, sink.asExpr()) } | @@ -26,8 +31,23 @@ module RemoteUserInputUnderflowConfig implements DataFlow::ConfigSig { | 26 | 31 | predicate isBarrierIn(DataFlow::Node node) { isSource(node) } | 27 | 32 | } | 28 | 33 |
| 29 | | -/** Taint-tracking flow for overflow from unvalidated user input. */ | 30 | | -module RemoteUserInputOverflow = TaintTracking::Global<RemoteUserInputOverflowConfig>; | | 34 | +/** | | 35 | + * DEPRECATED: Use `ArithmeticUnderflowConfig` instead. | | 36 | + */ | | 37 | +deprecated module RemoteUserInputUnderflowConfig = ArithmeticUnderflowConfig; | | 38 | + | | 39 | +/** Taint-tracking flow for overflow from unvalidated input. */ | | 40 | +module ArithmeticOverflow = TaintTracking::Global<ArithmeticOverflowConfig>; | | 41 | + | | 42 | +/** | | 43 | + * DEPRECATED: Use `ArithmeticOverflow` instead. | | 44 | + */ | | 45 | +deprecated module RemoteUserInputOverflow = ArithmeticOverflow; | | 46 | + | | 47 | +/** Taint-tracking flow for underflow from unvalidated input. */ | | 48 | +module ArithmeticUnderflow = TaintTracking::Global<ArithmeticUnderflowConfig>; | 31 | 49 |
| 32 | | -/** Taint-tracking flow for underflow from unvalidated user input. */ | 33 | | -module RemoteUserInputUnderflow = TaintTracking::Global<RemoteUserInputUnderflowConfig>; | | 50 | +/** | | 51 | + * DEPRECATED: Use `ArithmeticUnderflow` instead. | | 52 | + */ | | 53 | +deprecated module RemoteUserInputUnderflow = ArithmeticUnderflow; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/CommandLineQuery.qll +19-9Lines changed: 19 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,7 +48,7 @@ private class DefaultCommandInjectionSanitizer extends CommandInjectionSanitizer | 48 | 48 | /** | 49 | 49 | * A taint-tracking configuration for unvalidated user input that is used to run an external process. | 50 | 50 | */ | 51 | | -module RemoteUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { | | 51 | +module InputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { | 52 | 52 | predicate isSource(DataFlow::Node src) { src instanceof ThreatModelFlowSource } | 53 | 53 |
| 54 | 54 | predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink } | @@ -61,15 +61,24 @@ module RemoteUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig | 61 | 61 | } | 62 | 62 |
| 63 | 63 | /** | 64 | | - * Taint-tracking flow for unvalidated user input that is used to run an external process. | | 64 | + * DEPRECATED: Use `InputToArgumentToExecFlowConfig` instead. | 65 | 65 | */ | 66 | | -module RemoteUserInputToArgumentToExecFlow = | 67 | | - TaintTracking::Global<RemoteUserInputToArgumentToExecFlowConfig>; | | 66 | +deprecated module RemoteUserInputToArgumentToExecFlowConfig = InputToArgumentToExecFlowConfig; | | 67 | + | | 68 | +/** | | 69 | + * Taint-tracking flow for unvalidated input that is used to run an external process. | | 70 | + */ | | 71 | +module InputToArgumentToExecFlow = TaintTracking::Global<InputToArgumentToExecFlowConfig>; | | 72 | + | | 73 | +/** | | 74 | + * DEPRECATED: Use `InputToArgumentToExecFlow` instead. | | 75 | + */ | | 76 | +deprecated module RemoteUserInputToArgumentToExecFlow = InputToArgumentToExecFlow; | 68 | 77 |
| 69 | 78 | /** | 70 | 79 | * A taint-tracking configuration for unvalidated local user input that is used to run an external process. | 71 | 80 | */ | 72 | | -module LocalUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { | | 81 | +deprecated module LocalUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { | 73 | 82 | predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } | 74 | 83 |
| 75 | 84 | predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink } | @@ -82,9 +91,11 @@ module LocalUserInputToArgumentToExecFlowConfig implements DataFlow::ConfigSig { | 82 | 91 | } | 83 | 92 |
| 84 | 93 | /** | | 94 | + * DEPRECATED: Use `InputToArgumentToExecFlow` instead and configure threat model sources to include `local`. | | 95 | + * | 85 | 96 | * Taint-tracking flow for unvalidated local user input that is used to run an external process. | 86 | 97 | */ | 87 | | -module LocalUserInputToArgumentToExecFlow = | | 98 | +deprecated module LocalUserInputToArgumentToExecFlow = | 88 | 99 | TaintTracking::Global<LocalUserInputToArgumentToExecFlowConfig>; | 89 | 100 |
| 90 | 101 | /** | @@ -93,10 +104,9 @@ module LocalUserInputToArgumentToExecFlow = | 93 | 104 | * reporting overlapping results. | 94 | 105 | */ | 95 | 106 | predicate execIsTainted( | 96 | | - RemoteUserInputToArgumentToExecFlow::PathNode source, | 97 | | - RemoteUserInputToArgumentToExecFlow::PathNode sink, Expr execArg | | 107 | + InputToArgumentToExecFlow::PathNode source, InputToArgumentToExecFlow::PathNode sink, Expr execArg | 98 | 108 | ) { | 99 | | - RemoteUserInputToArgumentToExecFlow::flowPath(source, sink) and | | 109 | + InputToArgumentToExecFlow::flowPath(source, sink) and | 100 | 110 | argumentToExec(execArg, sink.getNode()) | 101 | 111 | } | 102 | 112 |
| |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ExecTaintedLocalQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ private import semmle.code.java.security.CommandArguments | 7 | 7 | private import semmle.code.java.security.Sanitizers | 8 | 8 |
| 9 | 9 | /** A taint-tracking configuration to reason about use of externally controlled strings to make command line commands. */ | 10 | | -module ExecTaintedLocalConfig implements DataFlow::ConfigSig { | | 10 | +deprecated module ExecTaintedLocalConfig implements DataFlow::ConfigSig { | 11 | 11 | predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } | 12 | 12 |
| 13 | 13 | predicate isSink(DataFlow::Node sink) { sink.asExpr() instanceof ArgumentToExec } | @@ -20,6 +20,8 @@ module ExecTaintedLocalConfig implements DataFlow::ConfigSig { | 20 | 20 | } | 21 | 21 |
| 22 | 22 | /** | | 23 | + * DEPRCATED: Unused. | | 24 | + * | 23 | 25 | * Taint-tracking flow for use of externally controlled strings to make command line commands. | 24 | 26 | */ | 25 | | -module ExecTaintedLocalFlow = TaintTracking::Global<ExecTaintedLocalConfig>; | | 27 | +deprecated module ExecTaintedLocalFlow = TaintTracking::Global<ExecTaintedLocalConfig>; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringLocalQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ private import semmle.code.java.dataflow.FlowSources | 5 | 5 | private import semmle.code.java.StringFormat | 6 | 6 |
| 7 | 7 | /** A taint-tracking configuration to reason about externally-controlled format strings from local sources. */ | 8 | | -module ExternallyControlledFormatStringLocalConfig implements DataFlow::ConfigSig { | | 8 | +deprecated module ExternallyControlledFormatStringLocalConfig implements DataFlow::ConfigSig { | 9 | 9 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 10 | 10 |
| 11 | 11 | predicate isSink(DataFlow::Node sink) { | @@ -18,7 +18,9 @@ module ExternallyControlledFormatStringLocalConfig implements DataFlow::ConfigSi | 18 | 18 | } | 19 | 19 |
| 20 | 20 | /** | | 21 | + * DEPRECATED: Use `ExternallyControlledFormatStringFlow` instead and configure threat model sources to include `local`. | | 22 | + * | 21 | 23 | * Taint-tracking flow for externally-controlled format strings from local sources. | 22 | 24 | */ | 23 | | -module ExternallyControlledFormatStringLocalFlow = | | 25 | +deprecated module ExternallyControlledFormatStringLocalFlow = | 24 | 26 | TaintTracking::Global<ExternallyControlledFormatStringLocalConfig>; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayConstructionLocalQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ private import semmle.code.java.dataflow.FlowSources | 7 | 7 | /** | 8 | 8 | * A taint-tracking configuration to reason about improper validation of local user-provided size used for array construction. | 9 | 9 | */ | 10 | | -module ImproperValidationOfArrayConstructionLocalConfig implements DataFlow::ConfigSig { | | 10 | +deprecated module ImproperValidationOfArrayConstructionLocalConfig implements DataFlow::ConfigSig { | 11 | 11 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 12 | 12 |
| 13 | 13 | predicate isSink(DataFlow::Node sink) { | @@ -16,7 +16,9 @@ module ImproperValidationOfArrayConstructionLocalConfig implements DataFlow::Con | 16 | 16 | } | 17 | 17 |
| 18 | 18 | /** | | 19 | + * DEPRECATED: Use `ImproperValidationOfArrayConstructionFlow` instead and configure threat model sources to include `local`. | | 20 | + * | 19 | 21 | * Taint-tracking flow for improper validation of local user-provided size used for array construction. | 20 | 22 | */ | 21 | | -module ImproperValidationOfArrayConstructionLocalFlow = | | 23 | +deprecated module ImproperValidationOfArrayConstructionLocalFlow = | 22 | 24 | TaintTracking::Global<ImproperValidationOfArrayConstructionLocalConfig>; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ImproperValidationOfArrayIndexLocalQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ private import semmle.code.java.dataflow.FlowSources | 7 | 7 | /** | 8 | 8 | * A taint-tracking configuration to reason about improper validation of local user-provided array index. | 9 | 9 | */ | 10 | | -module ImproperValidationOfArrayIndexLocalConfig implements DataFlow::ConfigSig { | | 10 | +deprecated module ImproperValidationOfArrayIndexLocalConfig implements DataFlow::ConfigSig { | 11 | 11 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 12 | 12 |
| 13 | 13 | predicate isSink(DataFlow::Node sink) { | @@ -20,7 +20,9 @@ module ImproperValidationOfArrayIndexLocalConfig implements DataFlow::ConfigSig | 20 | 20 | } | 21 | 21 |
| 22 | 22 | /** | | 23 | + * DEPRECATED: Use `ImproperValidationOfArrayIndexFlow` instead and configure threat model sources to include `local`. | | 24 | + * | 23 | 25 | * Taint-tracking flow for improper validation of local user-provided array index. | 24 | 26 | */ | 25 | | -module ImproperValidationOfArrayIndexLocalFlow = | | 27 | +deprecated module ImproperValidationOfArrayIndexLocalFlow = | 26 | 28 | TaintTracking::Global<ImproperValidationOfArrayIndexLocalConfig>; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/NumericCastTaintedQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -113,7 +113,7 @@ module NumericCastFlow = TaintTracking::Global<NumericCastFlowConfig>; | 113 | 113 | * A taint-tracking configuration for reasoning about local user input that is | 114 | 114 | * used in a numeric cast. | 115 | 115 | */ | 116 | | -module NumericCastLocalFlowConfig implements DataFlow::ConfigSig { | | 116 | +deprecated module NumericCastLocalFlowConfig implements DataFlow::ConfigSig { | 117 | 117 | predicate isSource(DataFlow::Node src) { src instanceof LocalUserInput } | 118 | 118 |
| 119 | 119 | predicate isSink(DataFlow::Node sink) { | @@ -134,6 +134,8 @@ module NumericCastLocalFlowConfig implements DataFlow::ConfigSig { | 134 | 134 | } | 135 | 135 |
| 136 | 136 | /** | | 137 | + * DEPRECATED: Use `NumericCastFlow` instead and configure threat model sources to include `local`. | | 138 | + * | 137 | 139 | * Taint-tracking flow for local user input that is used in a numeric cast. | 138 | 140 | */ | 139 | | -module NumericCastLocalFlow = TaintTracking::Global<NumericCastLocalFlowConfig>; | | 141 | +deprecated module NumericCastLocalFlow = TaintTracking::Global<NumericCastLocalFlowConfig>; |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ private import semmle.code.java.security.ResponseSplitting | 7 | 7 | /** | 8 | 8 | * A taint-tracking configuration to reason about response splitting vulnerabilities from local user input. | 9 | 9 | */ | 10 | | -module ResponseSplittingLocalConfig implements DataFlow::ConfigSig { | | 10 | +deprecated module ResponseSplittingLocalConfig implements DataFlow::ConfigSig { | 11 | 11 | predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } | 12 | 12 |
| 13 | 13 | predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink } | @@ -32,6 +32,8 @@ module ResponseSplittingLocalConfig implements DataFlow::ConfigSig { | 32 | 32 | } | 33 | 33 |
| 34 | 34 | /** | | 35 | + * DEPRECATED: Use `ResponseSplittingFlow` instead and configure threat model sources to include `local`. | | 36 | + * | 35 | 37 | * Taint-tracking flow for response splitting vulnerabilities from local user input. | 36 | 38 | */ | 37 | | -module ResponseSplittingLocalFlow = TaintTracking::Global<ResponseSplittingLocalConfig>; | | 39 | +deprecated module ResponseSplittingLocalFlow = TaintTracking::Global<ResponseSplittingLocalConfig>; |
|