Skip to content

Commit b8ce5e9

Browse files
committed
Python: Port py/insecure-temporary-file
1 parent f65843a commit b8ce5e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/ql/src/Security/CWE-377/InsecureTemporaryFile.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
*/
1212

1313
import python
14+
import semmle.python.ApiGraphs
1415

15-
FunctionValue temporary_name_function(string mod, string function) {
16+
API::Node temporary_name_function(string mod, string function) {
1617
(
1718
mod = "tempfile" and function = "mktemp"
1819
or
@@ -23,9 +24,9 @@ FunctionValue temporary_name_function(string mod, string function) {
2324
function = "tempnam"
2425
)
2526
) and
26-
result = Module::named(mod).attr(function)
27+
result = API::moduleImport(mod).getMember(function)
2728
}
2829

2930
from Call c, string mod, string function
30-
where temporary_name_function(mod, function).getACall().getNode() = c
31+
where temporary_name_function(mod, function).getACall().asExpr() = c
3132
select c, "Call to deprecated function " + mod + "." + function + " may be insecure."

0 commit comments

Comments
 (0)