Skip to content

Commit e726ff4

Browse files
committed
Python: simplify query code as suggested by review
1 parent 8b25806 commit e726ff4

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

python/ql/src/Security/CWE-327/InsecureDefaultProtocol.ql

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@
2020
import python
2121
import semmle.python.ApiGraphs
2222

23-
CallNode unsafe_call(string method_name) {
24-
result = API::moduleImport("ssl").getMember("wrap_socket").getACall().asCfgNode() and
25-
not exists(result.getArgByName("ssl_version")) and
26-
method_name = "deprecated method ssl.wrap_socket"
27-
}
28-
29-
from CallNode call, string method_name
30-
where call = unsafe_call(method_name)
23+
from DataFlow::CallCfgNode call
24+
where
25+
call = API::moduleImport("ssl").getMember("wrap_socket").getACall() and
26+
not exists(call.getArgByName("ssl_version"))
3127
select call,
32-
"Call to " + method_name +
33-
" does not specify a protocol, which may result in an insecure default being used."
28+
"Call to deprecated method ssl.wrap_socket does not specify a protocol, which may result in an insecure default being used."

0 commit comments

Comments
 (0)