File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
java/ql/src/experimental/Security/CWE/CWE-601 Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,18 @@ import SpringUrlRedirect
15
15
import semmle.code.java.dataflow.FlowSources
16
16
import DataFlow:: PathGraph
17
17
18
+ private class StartsWithSanitizer extends DataFlow:: BarrierGuard {
19
+ StartsWithSanitizer ( ) {
20
+ this .( MethodAccess ) .getMethod ( ) .hasName ( "startsWith" ) and
21
+ this .( MethodAccess ) .getMethod ( ) .getDeclaringType ( ) instanceof TypeString and
22
+ this .( MethodAccess ) .getMethod ( ) .getNumberOfParameters ( ) = 1
23
+ }
24
+
25
+ override predicate checks ( Expr e , boolean branch ) {
26
+ e = this .( MethodAccess ) .getQualifier ( ) and branch = true
27
+ }
28
+ }
29
+
18
30
class SpringUrlRedirectFlowConfig extends TaintTracking:: Configuration {
19
31
SpringUrlRedirectFlowConfig ( ) { this = "SpringUrlRedirectFlowConfig" }
20
32
Original file line number Diff line number Diff line change @@ -5,18 +5,6 @@ import semmle.code.java.dataflow.DataFlow2
5
5
import semmle.code.java.dataflow.TaintTracking
6
6
import semmle.code.java.frameworks.spring.SpringController
7
7
8
- private class StartsWithSanitizer extends DataFlow:: BarrierGuard {
9
- StartsWithSanitizer ( ) {
10
- this .( MethodAccess ) .getMethod ( ) .hasName ( "startsWith" ) and
11
- this .( MethodAccess ) .getMethod ( ) .getDeclaringType ( ) instanceof TypeString and
12
- this .( MethodAccess ) .getMethod ( ) .getNumberOfParameters ( ) = 1
13
- }
14
-
15
- override predicate checks ( Expr e , boolean branch ) {
16
- e = this .( MethodAccess ) .getQualifier ( ) and branch = true
17
- }
18
- }
19
-
20
8
/**
21
9
* A concatenate expression using the string `redirect:` or `ajaxredirect:` or `forward:` on the left.
22
10
*
You can’t perform that action at this time.
0 commit comments