mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
Python: simplify query code as suggested by review
This commit is contained in:
@@ -20,14 +20,9 @@
|
||||
import python
|
||||
import semmle.python.ApiGraphs
|
||||
|
||||
CallNode unsafe_call(string method_name) {
|
||||
result = API::moduleImport("ssl").getMember("wrap_socket").getACall().asCfgNode() and
|
||||
not exists(result.getArgByName("ssl_version")) and
|
||||
method_name = "deprecated method ssl.wrap_socket"
|
||||
}
|
||||
|
||||
from CallNode call, string method_name
|
||||
where call = unsafe_call(method_name)
|
||||
from DataFlow::CallCfgNode call
|
||||
where
|
||||
call = API::moduleImport("ssl").getMember("wrap_socket").getACall() and
|
||||
not exists(call.getArgByName("ssl_version"))
|
||||
select call,
|
||||
"Call to " + method_name +
|
||||
" does not specify a protocol, which may result in an insecure default being used."
|
||||
"Call to deprecated method ssl.wrap_socket does not specify a protocol, which may result in an insecure default being used."
|
||||
|
||||
Reference in New Issue
Block a user