File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
semmle/code/java/dataflow Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import semmle.code.java.dataflow.DataFlow
15
15
import semmle.code.java.dataflow.FlowSources
16
16
import semmle.code.java.security.Encryption
17
17
import DataFlow:: PathGraph
18
+ private import semmle.code.java.dataflow.ExternalFlow
18
19
19
20
/**
20
21
* Holds if `m` always returns `true` ignoring any exceptional flow.
@@ -49,14 +50,7 @@ class TrustAllHostnameVerifierConfiguration extends DataFlow::Configuration {
49
50
source .asExpr ( ) .( ClassInstanceExpr ) .getConstructedType ( ) instanceof TrustAllHostnameVerifier
50
51
}
51
52
52
- override predicate isSink ( DataFlow:: Node sink ) {
53
- exists ( MethodAccess ma , Method m |
54
- ( m instanceof SetDefaultHostnameVerifierMethod or m instanceof SetHostnameVerifierMethod ) and
55
- ma .getMethod ( ) = m
56
- |
57
- ma .getArgument ( 0 ) = sink .asExpr ( )
58
- )
59
- }
53
+ override predicate isSink ( DataFlow:: Node sink ) { sinkNode ( sink , "set-hostname" ) }
60
54
61
55
override predicate isBarrier ( DataFlow:: Node barrier ) {
62
56
// ignore nodes that are in functions that intentionally disable hostname verification
Original file line number Diff line number Diff line change @@ -207,7 +207,10 @@ private predicate sinkModelCsv(string row) {
207
207
"java.nio.file;Files;false;createTempDirectory;;;Argument[0];create-file" ,
208
208
"java.nio.file;Files;false;createTempFile;;;Argument[0];create-file" ,
209
209
// Bean validation
210
- "javax.validation;ConstraintValidatorContext;true;buildConstraintViolationWithTemplate;;;Argument[0];bean-validation"
210
+ "javax.validation;ConstraintValidatorContext;true;buildConstraintViolationWithTemplate;;;Argument[0];bean-validation" ,
211
+ // Set hostname
212
+ "javax.net.ssl;HttpsURLConnection;true;setDefaultHostnameVerifier;;;Argument[0];set-hostname" ,
213
+ "javax.net.ssl;HttpsURLConnection;true;setHostnameVerifier;;;Argument[0];set-hostname"
211
214
]
212
215
}
213
216
You can’t perform that action at this time.
0 commit comments