@@ -3,7 +3,8 @@ import TlsLibraryModel
3
3
4
4
/**
5
5
* Configuration to determine the state of a context being used to create
6
- * a conection.
6
+ * a conection. There is one configuration for each pair of `TlsLibrary` and `ProtocolVersion`,
7
+ * such that a single configuration only tracks contexts where a specific `ProtocolVersion` is allowed.
7
8
*
8
9
* The state is in terms of whether a specific protocol is allowed. This is
9
10
* either true or false when the context is created and can then be modified
@@ -72,20 +73,18 @@ predicate unsafe_connection_creation_with_context(
72
73
boolean specific
73
74
) {
74
75
// Connection created from a context allowing `insecure_version`.
75
- exists ( InsecureContextConfiguration c , ProtocolUnrestriction co |
76
- c .hasFlow ( co , connectionCreation )
76
+ exists ( InsecureContextConfiguration c |
77
+ c .hasFlow ( contextOrigin , connectionCreation )
77
78
|
78
79
insecure_version = c .getTrackedVersion ( ) and
79
- contextOrigin = co and
80
+ contextOrigin instanceof ProtocolUnrestriction and
80
81
specific = false
81
82
)
82
83
or
83
84
// Connection created from a context specifying `insecure_version`.
84
- exists ( TlsLibrary l , DataFlow:: CfgNode cc |
85
- cc = l .insecure_connection_creation ( insecure_version )
86
- |
87
- connectionCreation = cc and
88
- contextOrigin = cc and
85
+ exists ( TlsLibrary l |
86
+ connectionCreation = l .insecure_connection_creation ( insecure_version ) and
87
+ contextOrigin = connectionCreation and
89
88
specific = true
90
89
)
91
90
}
@@ -105,7 +104,6 @@ predicate unsafe_connection_creation_without_context(
105
104
106
105
/** Holds if `contextCreation` is creating a context ties to a specific insecure version. */
107
106
predicate unsafe_context_creation ( DataFlow:: CallCfgNode contextCreation , string insecure_version ) {
108
- exists ( TlsLibrary l , ContextCreation cc | cc = l .insecure_context_creation ( insecure_version ) |
109
- contextCreation = cc
110
- )
107
+ contextCreation instanceof ContextCreation and
108
+ exists ( TlsLibrary l | contextCreation = l .insecure_context_creation ( insecure_version ) )
111
109
}
0 commit comments