File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
java/ql/src/experimental/Security/CWE/CWE-094 Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import semmle.code.java.dataflow.FlowSources
5
5
* Holds if `fromNode` to `toNode` is a dataflow step that returns data from
6
6
* a bean by calling one of its getters.
7
7
*/
8
- predicate returnsDataFromBean ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
8
+ predicate hasGetterFlow ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
9
9
exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
10
10
m instanceof GetterMethod and
11
11
ma .getQualifier ( ) = fromNode .asExpr ( ) and
Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ with sandboxing capabilities such as Apache Commons JEXL or the Spring Expressio
29
29
The following example shows how untrusted data is used to build and run an expression
30
30
using the JUEL interpreter:
31
31
</p >
32
- <sample src =" UnsafeExpressionEvaluationWithJUEL .java" />
32
+ <sample src =" UnsafeExpressionEvaluationWithJuel .java" />
33
33
34
34
<p >
35
- JUEL does not support to run expressions in a sandbox. To prevent running arbitrary code,
35
+ JUEL does not support running expressions in a sandbox. To prevent running arbitrary code,
36
36
incoming data has to be checked before including it in an expression. The next example
37
37
uses a Regex pattern to check whether a user tries to run an allowed expression or not:
38
38
</p >
39
- <sample src =" SaferExpressionEvaluationWithJUEL .java" />
39
+ <sample src =" SaferExpressionEvaluationWithJuel .java" />
40
40
41
41
</example >
42
42
Original file line number Diff line number Diff line change 1
1
import java
2
- import InjectionLib
2
+ import FlowUtils
3
3
import semmle.code.java.dataflow.FlowSources
4
4
import semmle.code.java.dataflow.TaintTracking
5
5
@@ -16,7 +16,7 @@ class JakartaExpressionInjectionConfig extends TaintTracking::Configuration {
16
16
17
17
override predicate isAdditionalTaintStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
18
18
any ( TaintPropagatingCall c ) .taintFlow ( fromNode , toNode ) or
19
- returnsDataFromBean ( fromNode , toNode )
19
+ hasGetterFlow ( fromNode , toNode )
20
20
}
21
21
}
22
22
Original file line number Diff line number Diff line change 1
1
import java
2
- import InjectionLib
2
+ import FlowUtils
3
3
import semmle.code.java.dataflow.FlowSources
4
4
import semmle.code.java.dataflow.TaintTracking
5
5
@@ -17,7 +17,7 @@ class JexlInjectionConfig extends TaintTracking::Configuration {
17
17
18
18
override predicate isAdditionalTaintStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
19
19
any ( TaintPropagatingJexlMethodCall c ) .taintFlow ( fromNode , toNode ) or
20
- returnsDataFromBean ( fromNode , toNode )
20
+ hasGetterFlow ( fromNode , toNode )
21
21
}
22
22
}
23
23
You can’t perform that action at this time.
0 commit comments