File tree Expand file tree Collapse file tree
java/ql/src/experimental/Security/CWE/CWE-094 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import semmle.code.java.dataflow.FlowSources
55 * Holds if `fromNode` to `toNode` is a dataflow step that returns data from
66 * a bean by calling one of its getters.
77 */
8- predicate returnsDataFromBean ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
8+ predicate hasGetterFlow ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
99 exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
1010 m instanceof GetterMethod and
1111 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
2929The following example shows how untrusted data is used to build and run an expression
3030using the JUEL interpreter:
3131</p >
32- <sample src =" UnsafeExpressionEvaluationWithJUEL .java" />
32+ <sample src =" UnsafeExpressionEvaluationWithJuel .java" />
3333
3434<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,
3636incoming data has to be checked before including it in an expression. The next example
3737uses a Regex pattern to check whether a user tries to run an allowed expression or not:
3838</p >
39- <sample src =" SaferExpressionEvaluationWithJUEL .java" />
39+ <sample src =" SaferExpressionEvaluationWithJuel .java" />
4040
4141</example >
4242
Original file line number Diff line number Diff line change 11import java
2- import InjectionLib
2+ import FlowUtils
33import semmle.code.java.dataflow.FlowSources
44import semmle.code.java.dataflow.TaintTracking
55
@@ -16,7 +16,7 @@ class JakartaExpressionInjectionConfig extends TaintTracking::Configuration {
1616
1717 override predicate isAdditionalTaintStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
1818 any ( TaintPropagatingCall c ) .taintFlow ( fromNode , toNode ) or
19- returnsDataFromBean ( fromNode , toNode )
19+ hasGetterFlow ( fromNode , toNode )
2020 }
2121}
2222
Original file line number Diff line number Diff line change 11import java
2- import InjectionLib
2+ import FlowUtils
33import semmle.code.java.dataflow.FlowSources
44import semmle.code.java.dataflow.TaintTracking
55
@@ -17,7 +17,7 @@ class JexlInjectionConfig extends TaintTracking::Configuration {
1717
1818 override predicate isAdditionalTaintStep ( DataFlow:: Node fromNode , DataFlow:: Node toNode ) {
1919 any ( TaintPropagatingJexlMethodCall c ) .taintFlow ( fromNode , toNode ) or
20- returnsDataFromBean ( fromNode , toNode )
20+ hasGetterFlow ( fromNode , toNode )
2121 }
2222}
2323
You can’t perform that action at this time.
0 commit comments