@@ -9,7 +9,7 @@ import semmle.code.java.security.UrlRedirect
9
9
import Regex
10
10
11
11
/** A string that ends with `.*` not prefixed with `\`. */
12
- class PermissiveDotStr extends StringLiteral {
12
+ private class PermissiveDotStr extends StringLiteral {
13
13
PermissiveDotStr ( ) {
14
14
exists ( string s , int i | this .getValue ( ) = s |
15
15
s .indexOf ( ".*" ) = i and
@@ -19,7 +19,7 @@ class PermissiveDotStr extends StringLiteral {
19
19
}
20
20
}
21
21
22
- /** Source model of remote flow source with servlets . */
22
+ /** Remote flow sources obtained from the URI of a servlet request . */
23
23
private class GetServletUriSource extends SourceModelCsv {
24
24
override predicate row ( string row ) {
25
25
row =
@@ -33,7 +33,7 @@ private class GetServletUriSource extends SourceModelCsv {
33
33
}
34
34
}
35
35
36
- /** Sink of servlet dispatcher . */
36
+ /** The qualifier of a request dispatch method call . */
37
37
private class UrlDispatchSink extends UrlRedirectSink {
38
38
UrlDispatchSink ( ) {
39
39
exists ( MethodAccess ma |
@@ -51,7 +51,7 @@ private class ServletFilterMethod extends Method {
51
51
}
52
52
}
53
53
54
- /** Sink of servlet filter. */
54
+ /** The qualifier of a servlet filter method call . */
55
55
private class UrlFilterSink extends UrlRedirectSink {
56
56
UrlFilterSink ( ) {
57
57
exists ( MethodAccess ma |
@@ -61,16 +61,17 @@ private class UrlFilterSink extends UrlRedirectSink {
61
61
}
62
62
}
63
63
64
- /** A Spring framework annotation indicating remote uri user input . */
65
- class SpringUriInputAnnotation extends Annotation {
64
+ /** A Spring framework annotation indicating that a URI is user-provided . */
65
+ private class SpringUriInputAnnotation extends Annotation {
66
66
SpringUriInputAnnotation ( ) {
67
67
this .getType ( )
68
68
.hasQualifiedName ( "org.springframework.web.bind.annotation" ,
69
69
[ "PathVariable" , "RequestParam" ] )
70
70
}
71
71
}
72
72
73
- class SpringUriInputParameterSource extends DataFlow:: Node {
73
+ /** A user-provided URI parameter of a request mapping method. */
74
+ private class SpringUriInputParameterSource extends DataFlow:: Node {
74
75
SpringUriInputParameterSource ( ) {
75
76
this .asParameter ( ) =
76
77
any ( SpringRequestMappingParameter srmp |
@@ -82,7 +83,7 @@ class SpringUriInputParameterSource extends DataFlow::Node {
82
83
/**
83
84
* A data flow sink to construct regular expressions.
84
85
*/
85
- class CompileRegexSink extends DataFlow:: ExprNode {
86
+ private class CompileRegexSink extends DataFlow:: ExprNode {
86
87
CompileRegexSink ( ) {
87
88
exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
88
89
(
@@ -100,9 +101,9 @@ class CompileRegexSink extends DataFlow::ExprNode {
100
101
}
101
102
102
103
/**
103
- * A flow configuration for permissive dot regex .
104
+ * A data flow configuration for regular expressions that include permissive dots .
104
105
*/
105
- class PermissiveDotRegexConfig extends DataFlow2:: Configuration {
106
+ private class PermissiveDotRegexConfig extends DataFlow2:: Configuration {
106
107
PermissiveDotRegexConfig ( ) { this = "PermissiveDotRegex::PermissiveDotRegexConfig" }
107
108
108
109
override predicate isSource ( DataFlow2:: Node src ) { src .asExpr ( ) instanceof PermissiveDotStr }
@@ -123,7 +124,8 @@ class PermissiveDotRegexConfig extends DataFlow2::Configuration {
123
124
}
124
125
125
126
/**
126
- * A taint-tracking configuration for untrusted user input used to match regular expressions.
127
+ * A taint-tracking configuration for untrusted user input used to match regular expressions
128
+ * that include permissive dots.
127
129
*/
128
130
class MatchRegexConfiguration extends TaintTracking:: Configuration {
129
131
MatchRegexConfiguration ( ) { this = "PermissiveDotRegex::MatchRegexConfiguration" }
@@ -173,12 +175,15 @@ class MatchRegexConfiguration extends TaintTracking::Configuration {
173
175
}
174
176
}
175
177
178
+ /**
179
+ * A data flow sink representing a string being matched against a regular expression.
180
+ */
176
181
abstract class MatchRegexSink extends DataFlow:: ExprNode { }
177
182
178
183
/**
179
- * A data flow sink to string match regular expressions .
184
+ * A string being matched against a regular expression .
180
185
*/
181
- class StringMatchRegexSink extends MatchRegexSink {
186
+ private class StringMatchRegexSink extends MatchRegexSink {
182
187
StringMatchRegexSink ( ) {
183
188
exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
184
189
(
@@ -190,9 +195,9 @@ class StringMatchRegexSink extends MatchRegexSink {
190
195
}
191
196
192
197
/**
193
- * A data flow sink to `pattern.matches` regular expressions .
198
+ * A string being matched against a regular expression using a pattern .
194
199
*/
195
- class PatternMatchRegexSink extends MatchRegexSink {
200
+ private class PatternMatchRegexSink extends MatchRegexSink {
196
201
PatternMatchRegexSink ( ) {
197
202
exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
198
203
(
@@ -204,9 +209,9 @@ class PatternMatchRegexSink extends MatchRegexSink {
204
209
}
205
210
206
211
/**
207
- * A data flow sink to `pattern.matcher` match regular expressions .
212
+ * A string being used to create a pattern matcher .
208
213
*/
209
- class PatternMatcherRegexSink extends MatchRegexSink {
214
+ private class PatternMatcherRegexSink extends MatchRegexSink {
210
215
PatternMatcherRegexSink ( ) {
211
216
exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
212
217
(
0 commit comments