@@ -6,6 +6,7 @@ private import semmle.code.java.dataflow.FlowSources
6
6
private import semmle.code.java.dataflow.StringPrefixes
7
7
private import semmle.code.java.security.PathSanitizer
8
8
private import semmle.code.java.controlflow.Guards
9
+ private import semmle.code.java.security.Sanitizers
9
10
10
11
/** A URL forward sink. */
11
12
abstract class UrlForwardSink extends DataFlow:: Node { }
@@ -38,13 +39,7 @@ private class ForwardPrefix extends InterestingPrefix {
38
39
/** A URL forward barrier. */
39
40
abstract class UrlForwardBarrier extends DataFlow:: Node { }
40
41
41
- private class PrimitiveBarrier extends UrlForwardBarrier {
42
- PrimitiveBarrier ( ) {
43
- this .getType ( ) instanceof PrimitiveType or
44
- this .getType ( ) instanceof BoxedType or
45
- this .getType ( ) instanceof NumberType
46
- }
47
- }
42
+ private class PrimitiveBarrier extends UrlForwardBarrier instanceof SimpleTypeSanitizer { }
48
43
49
44
// TODO: should this also take URL encoding/decoding into account?
50
45
// TODO: and PathSanitization in general?
@@ -87,9 +82,7 @@ private class DefaultUrlDecodeCall extends UrlDecodeCall {
87
82
// TODO: this can probably be named/designed better...
88
83
abstract class RepeatedStmt extends Stmt { }
89
84
90
- private class DefaultRepeatedStmt extends RepeatedStmt {
91
- DefaultRepeatedStmt ( ) { this instanceof LoopStmt }
92
- }
85
+ private class DefaultRepeatedStmt extends RepeatedStmt instanceof LoopStmt { }
93
86
94
87
abstract class CheckEncodingCall extends MethodCall { }
95
88
@@ -111,9 +104,7 @@ private class RepeatedUrlDecodeCall extends MethodCall {
111
104
}
112
105
}
113
106
114
- private class CheckEncodingGuard extends Guard instanceof MethodCall {
115
- CheckEncodingGuard ( ) { this instanceof CheckEncodingCall }
116
-
107
+ private class CheckEncodingGuard extends Guard instanceof MethodCall , CheckEncodingCall {
117
108
Expr getCheckedExpr ( ) { result = this .( MethodCall ) .getQualifier ( ) }
118
109
}
119
110
0 commit comments