@@ -103,7 +103,7 @@ private predicate isContainsUrlSanitizer(Guard guard, Expr e, boolean branch) {
103
103
* This `contains` method is usually called on a list, but the sanitizer matches any call to a method
104
104
* called `contains`, so other methods with the same name will also be considered sanitizers.
105
105
*/
106
- class ContainsUrlSanitizer extends RequestForgerySanitizer {
106
+ private class ContainsUrlSanitizer extends RequestForgerySanitizer {
107
107
ContainsUrlSanitizer ( ) {
108
108
this = DataFlow:: BarrierGuard< isContainsUrlSanitizer / 3 > :: getABarrierNode ( )
109
109
}
@@ -115,11 +115,7 @@ class ContainsUrlSanitizer extends RequestForgerySanitizer {
115
115
private predicate isRelativeUrlSanitizer ( Guard guard , Expr e , boolean branch ) {
116
116
guard =
117
117
any ( MethodCall call |
118
- exists ( Method method |
119
- call .getMethod ( ) = method and
120
- method .getName ( ) = "isAbsolute" and
121
- method .getDeclaringType ( ) .hasQualifiedName ( "java.net" , "URI" )
122
- ) and
118
+ call .getMethod ( ) .hasQualifiedName ( "java.net" , "URI" , "isAbsolute" ) and
123
119
e = call .getQualifier ( ) and
124
120
branch = false
125
121
)
@@ -128,7 +124,7 @@ private predicate isRelativeUrlSanitizer(Guard guard, Expr e, boolean branch) {
128
124
/**
129
125
* A check that the URL is relative, and therefore safe for URL redirects.
130
126
*/
131
- class RelativeUrlSanitizer extends RequestForgerySanitizer {
127
+ private class RelativeUrlSanitizer extends RequestForgerySanitizer {
132
128
RelativeUrlSanitizer ( ) {
133
129
this = DataFlow:: BarrierGuard< isRelativeUrlSanitizer / 3 > :: getABarrierNode ( )
134
130
}
@@ -145,8 +141,7 @@ private predicate isHostComparisonSanitizer(Guard guard, Expr e, boolean branch)
145
141
branch = true and
146
142
exists ( MethodCall hostCall |
147
143
hostCall = [ equalsCall .getQualifier ( ) , equalsCall .getArgument ( 0 ) ] and
148
- hostCall .getMethod ( ) .getName ( ) = "getHost" and
149
- hostCall .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "java.net" , "URI" ) and
144
+ hostCall .getMethod ( ) .hasQualifiedName ( "java.net" , "URI" , "getHost" ) and
150
145
e = hostCall .getQualifier ( )
151
146
)
152
147
)
@@ -155,7 +150,7 @@ private predicate isHostComparisonSanitizer(Guard guard, Expr e, boolean branch)
155
150
/**
156
151
* A comparison on the `Host` property of a url, that is a sanitizer for URL redirects.
157
152
*/
158
- class HostComparisonSanitizer extends RequestForgerySanitizer {
153
+ private class HostComparisonSanitizer extends RequestForgerySanitizer {
159
154
HostComparisonSanitizer ( ) {
160
155
this = DataFlow:: BarrierGuard< isHostComparisonSanitizer / 3 > :: getABarrierNode ( )
161
156
}
0 commit comments