File tree Expand file tree Collapse file tree
semmle/code/java/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import semmle.code.java.dataflow.DataFlow
1515import semmle.code.java.dataflow.FlowSources
1616import semmle.code.java.security.Encryption
1717import DataFlow:: PathGraph
18+ private import semmle.code.java.dataflow.ExternalFlow
1819
1920/**
2021 * Holds if `m` always returns `true` ignoring any exceptional flow.
@@ -49,14 +50,7 @@ class TrustAllHostnameVerifierConfiguration extends DataFlow::Configuration {
4950 source .asExpr ( ) .( ClassInstanceExpr ) .getConstructedType ( ) instanceof TrustAllHostnameVerifier
5051 }
5152
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" ) }
6054
6155 override predicate isBarrier ( DataFlow:: Node barrier ) {
6256 // 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) {
207207 "java.nio.file;Files;false;createTempDirectory;;;Argument[0];create-file" ,
208208 "java.nio.file;Files;false;createTempFile;;;Argument[0];create-file" ,
209209 // 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"
211214 ]
212215}
213216
You can’t perform that action at this time.
0 commit comments