1- import python
2- import semmle.python.ApiGraphs
1+ private import python
2+ private import semmle.python.ApiGraphs
33import Ssl
44import PyOpenSSL
55
66/**
7- * A specific protocol version.
8- * We use this to identify a protocol.
7+ * A specific protocol version of SSL or TLS.
98 */
109class ProtocolVersion extends string {
1110 ProtocolVersion ( ) { this in [ "SSLv2" , "SSLv3" , "TLSv1" , "TLSv1_1" , "TLSv1_2" , "TLSv1_3" ] }
1211
12+ /** Gets a `ProtocolVersion` that is less than this `ProtocolVersion`, if any. */
1313 predicate lessThan ( ProtocolVersion version ) {
1414 this = "SSLv2" and version = "SSLv3"
1515 or
@@ -20,6 +20,7 @@ class ProtocolVersion extends string {
2020 this = [ "TLSv1" , "TLSv1_1" , "TLSv1_2" ] and version = "TLSv1_3"
2121 }
2222
23+ /** Holds if this protocol version is known to be insecure. */
2324 predicate isInsecure ( ) { this in [ "SSLv2" , "SSLv3" , "TLSv1" , "TLSv1_1" ] }
2425}
2526
@@ -81,12 +82,13 @@ abstract class UnspecificContextCreation extends ContextCreation, ProtocolUnrest
8182
8283/** A model of a SSL/TLS library. */
8384abstract class TlsLibrary extends string {
84- TlsLibrary ( ) { this in [ "ssl" , "pyOpenSSL" ] }
85+ bindingset [ this ]
86+ TlsLibrary ( ) { any ( ) }
8587
8688 /** The name of a specific protocol version. */
8789 abstract string specific_version_name ( ProtocolVersion version ) ;
8890
89- /** The name of an unspecific protocol version, say TLS, known to have insecure instances . */
91+ /** Gets a name, which is a member of `version_constants`, that can be used to specify the protocol family `family` . */
9092 abstract string unspecific_version_name ( ProtocolFamily family ) ;
9193
9294 /** The module or class holding the version constants. */
@@ -97,12 +99,12 @@ abstract class TlsLibrary extends string {
9799 result = version_constants ( ) .getMember ( specific_version_name ( version ) ) .getAUse ( )
98100 }
99101
100- /** A dataflow node representing an unspecific protocol version, say TLS, known to have insecure instances . */
102+ /** Gets a dataflow node representing the protocol family `family` . */
101103 DataFlow:: Node unspecific_version ( ProtocolFamily family ) {
102104 result = version_constants ( ) .getMember ( unspecific_version_name ( family ) ) .getAUse ( )
103105 }
104106
105- /** The creation of a context with a deafult protocol. */
107+ /** The creation of a context with a default protocol. */
106108 abstract ContextCreation default_context_creation ( ) ;
107109
108110 /** The creation of a context with a specific protocol. */
@@ -115,7 +117,7 @@ abstract class TlsLibrary extends string {
115117 version .isInsecure ( )
116118 }
117119
118- /** The creation of a context with an unspecific protocol version, say TLS , known to have insecure instances. */
120+ /** Gets a context that was created using `family` , known to have insecure instances. */
119121 ContextCreation unspecific_context_creation ( ProtocolFamily family ) {
120122 result in [ specific_context_creation ( ) , default_context_creation ( ) ] and
121123 result .getProtocol ( ) = family
0 commit comments