mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
Merge pull request #5248 from tausbn/python-port-insecure-temporary-file
Python: Port `py/insecure-temporary-file`
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
import semmle.python.ApiGraphs
|
||||
|
||||
FunctionValue temporary_name_function(string mod, string function) {
|
||||
API::Node temporary_name_function(string mod, string function) {
|
||||
(
|
||||
mod = "tempfile" and function = "mktemp"
|
||||
or
|
||||
@@ -23,9 +24,9 @@ FunctionValue temporary_name_function(string mod, string function) {
|
||||
function = "tempnam"
|
||||
)
|
||||
) and
|
||||
result = Module::named(mod).attr(function)
|
||||
result = API::moduleImport(mod).getMember(function)
|
||||
}
|
||||
|
||||
from Call c, string mod, string function
|
||||
where temporary_name_function(mod, function).getACall().getNode() = c
|
||||
where temporary_name_function(mod, function).getACall().asExpr() = c
|
||||
select c, "Call to deprecated function " + mod + "." + function + " may be insecure."
|
||||
|
||||
Reference in New Issue
Block a user