Skip to content

Commit fc2c623

Browse files
committed
Python: Fix bad join
Also fixed up the QLDoc
1 parent 9c893cb commit fc2c623

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

python/ql/src/Security/CWE-327/PyOpenSSL.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class PyOpenSSLContextCreation extends ContextCreation, DataFlow::CallCfgNode {
1616
exists(ControlFlowNode protocolArg, PyOpenSSL pyo |
1717
protocolArg in [node.getArg(0), node.getArgByName("method")]
1818
|
19-
protocolArg = [pyo.specific_version(result), pyo.unspecific_version(result)].asCfgNode()
19+
protocolArg =
20+
[pyo.specific_version(result).getAUse(), pyo.unspecific_version(result).getAUse()]
21+
.asCfgNode()
2022
)
2123
}
2224
}

python/ql/src/Security/CWE-327/Ssl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class SSLContextCreation extends ContextCreation, DataFlow::CallCfgNode {
1414
exists(ControlFlowNode protocolArg, Ssl ssl |
1515
protocolArg in [node.getArg(0), node.getArgByName("protocol")]
1616
|
17-
protocolArg = [ssl.specific_version(result), ssl.unspecific_version(result)].asCfgNode()
17+
protocolArg =
18+
[ssl.specific_version(result).getAUse(), ssl.unspecific_version(result).getAUse()]
19+
.asCfgNode()
1820
)
1921
or
2022
not exists(node.getAnArg()) and
@@ -188,7 +190,7 @@ class Ssl extends TlsLibrary {
188190

189191
override DataFlow::CallCfgNode insecure_connection_creation(ProtocolVersion version) {
190192
result = API::moduleImport("ssl").getMember("wrap_socket").getACall() and
191-
this.specific_version(version) = result.getArgByName("ssl_version") and
193+
this.specific_version(version).getAUse() = result.getArgByName("ssl_version") and
192194
version.isInsecure()
193195
}
194196

python/ql/src/Security/CWE-327/TlsLibraryModel.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,26 @@ abstract class TlsLibrary extends string {
9191
/** Gets a name, which is a member of `version_constants`, that can be used to specify the protocol family `family`. */
9292
abstract string unspecific_version_name(ProtocolFamily family);
9393

94-
/** The module or class holding the version constants. */
94+
/** Gets an API node representing the module or class holding the version constants. */
9595
abstract API::Node version_constants();
9696

97-
/** A dataflow node representing a specific protocol version. */
98-
DataFlow::Node specific_version(ProtocolVersion version) {
99-
result = version_constants().getMember(specific_version_name(version)).getAUse()
97+
/** Gets an API node representing a specific protocol version. */
98+
API::Node specific_version(ProtocolVersion version) {
99+
result = version_constants().getMember(specific_version_name(version))
100100
}
101101

102-
/** Gets a dataflow node representing the protocol family `family`. */
103-
DataFlow::Node unspecific_version(ProtocolFamily family) {
104-
result = version_constants().getMember(unspecific_version_name(family)).getAUse()
102+
/** Gets an API node representing the protocol family `family`. */
103+
API::Node unspecific_version(ProtocolFamily family) {
104+
result = version_constants().getMember(unspecific_version_name(family))
105105
}
106106

107-
/** The creation of a context with a default protocol. */
107+
/** Gets a creation of a context with a default protocol. */
108108
abstract ContextCreation default_context_creation();
109109

110-
/** The creation of a context with a specific protocol. */
110+
/** Gets a creation of a context with a specific protocol. */
111111
abstract ContextCreation specific_context_creation();
112112

113-
/** The creation of a context with a specific protocol version, known to be insecure. */
113+
/** Gets a creation of a context with a specific protocol version, known to be insecure. */
114114
ContextCreation insecure_context_creation(ProtocolVersion version) {
115115
result in [specific_context_creation(), default_context_creation()] and
116116
result.getProtocol() = version and
@@ -123,15 +123,15 @@ abstract class TlsLibrary extends string {
123123
result.getProtocol() = family
124124
}
125125

126-
/** A connection is created in an insecure manner, not from a context. */
126+
/** Gets a dataflow node representing a connection being created in an insecure manner, not from a context. */
127127
abstract DataFlow::Node insecure_connection_creation(ProtocolVersion version);
128128

129-
/** A connection is created from a context. */
129+
/** Gets a dataflow node representing a connection being created from a context. */
130130
abstract ConnectionCreation connection_creation();
131131

132-
/** A context is being restricted on which protocols it can accepts. */
132+
/** Gets a dataflow node representing a context being restricted on which protocols it can accepts. */
133133
abstract ProtocolRestriction protocol_restriction();
134134

135-
/** A context is being relaxed on which protocols it can accepts. */
135+
/** Gets a dataflow node representing a context being relaxed on which protocols it can accepts. */
136136
abstract ProtocolUnrestriction protocol_unrestriction();
137137
}

0 commit comments

Comments
 (0)