@@ -6,9 +6,11 @@ import semmle.code.java.security.UnsafeCertTrust
6
6
import semmle.code.java.security.Encryption
7
7
8
8
/**
9
+ * DEPRECATED: Use `SslEndpointIdentificationFlow` instead.
10
+ *
9
11
* A taint flow configuration for SSL connections created without a proper certificate trust configuration.
10
12
*/
11
- class SslEndpointIdentificationFlowConfig extends TaintTracking:: Configuration {
13
+ deprecated class SslEndpointIdentificationFlowConfig extends TaintTracking:: Configuration {
12
14
SslEndpointIdentificationFlowConfig ( ) { this = "SslEndpointIdentificationFlowConfig" }
13
15
14
16
override predicate isSource ( DataFlow:: Node source ) { source instanceof SslConnectionInit }
@@ -20,30 +22,38 @@ class SslEndpointIdentificationFlowConfig extends TaintTracking::Configuration {
20
22
}
21
23
}
22
24
25
+ private module SslEndpointIdentificationFlowConfig implements DataFlow:: ConfigSig {
26
+ predicate isSource ( DataFlow:: Node source ) { source instanceof SslConnectionInit }
27
+
28
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof SslConnectionCreation }
29
+
30
+ predicate isBarrier ( DataFlow:: Node sanitizer ) { sanitizer instanceof SslUnsafeCertTrustSanitizer }
31
+ }
32
+
33
+ module SslEndpointIdentificationFlow = TaintTracking:: Global< SslEndpointIdentificationFlowConfig > ;
34
+
23
35
/**
24
36
* An SSL object that was assigned a safe `SSLParameters` object and can be considered safe.
25
37
*/
26
38
private class SslConnectionWithSafeSslParameters extends SslUnsafeCertTrustSanitizer {
27
39
SslConnectionWithSafeSslParameters ( ) {
28
- exists ( SafeSslParametersFlowConfig config , DataFlow:: Node safe , DataFlow:: Node sanitizer |
29
- config . hasFlowTo ( safe ) and
40
+ exists ( DataFlow:: Node safe , DataFlow:: Node sanitizer |
41
+ SafeSslParametersFlow :: flowTo ( safe ) and
30
42
sanitizer = DataFlow:: exprNode ( safe .asExpr ( ) .( Argument ) .getCall ( ) .getQualifier ( ) ) and
31
43
DataFlow:: localFlow ( sanitizer , this )
32
44
)
33
45
}
34
46
}
35
47
36
- private class SafeSslParametersFlowConfig extends DataFlow2:: Configuration {
37
- SafeSslParametersFlowConfig ( ) { this = "SafeSslParametersFlowConfig" }
38
-
39
- override predicate isSource ( DataFlow:: Node source ) {
48
+ private module SafeSslParametersFlowConfig implements DataFlow:: ConfigSig {
49
+ predicate isSource ( DataFlow:: Node source ) {
40
50
exists ( MethodAccess ma |
41
51
ma instanceof SafeSetEndpointIdentificationAlgorithm and
42
52
DataFlow:: getInstanceArgument ( ma ) = source .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( )
43
53
)
44
54
}
45
55
46
- override predicate isSink ( DataFlow:: Node sink ) {
56
+ predicate isSink ( DataFlow:: Node sink ) {
47
57
exists ( MethodAccess ma , RefType t | t instanceof SslSocket or t instanceof SslEngine |
48
58
ma .getMethod ( ) .hasName ( "setSSLParameters" ) and
49
59
ma .getMethod ( ) .getDeclaringType ( ) .getAnAncestor ( ) = t and
@@ -52,6 +62,8 @@ private class SafeSslParametersFlowConfig extends DataFlow2::Configuration {
52
62
}
53
63
}
54
64
65
+ private module SafeSslParametersFlow = DataFlow:: Global< SafeSslParametersFlowConfig > ;
66
+
55
67
/**
56
68
* A call to `SSLParameters.setEndpointIdentificationAlgorithm` with a non-null and non-empty parameter.
57
69
*/
0 commit comments