mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Move query tests to reflect new file layout
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| InsecureTemporaryFile.py:5:16:5:23 | mktemp() | Call to deprecated function tempfile.mktemp may be insecure. |
|
||||
| InsecureTemporaryFile.py:11:16:11:27 | Attribute() | Call to deprecated function os.tempnam may be insecure. |
|
||||
| InsecureTemporaryFile.py:17:16:17:26 | Attribute() | Call to deprecated function os.tmpnam may be insecure. |
|
||||
@@ -0,0 +1,20 @@
|
||||
from tempfile import mktemp
|
||||
import os
|
||||
|
||||
def write_results1(results):
|
||||
filename = mktemp()
|
||||
with open(filename, "w+") as f:
|
||||
f.write(results)
|
||||
print("Results written to", filename)
|
||||
|
||||
def write_results2(results):
|
||||
filename = os.tempnam()
|
||||
with open(filename, "w+") as f:
|
||||
f.write(results)
|
||||
print("Results written to", filename)
|
||||
|
||||
def write_results3(results):
|
||||
filename = os.tmpnam()
|
||||
with open(filename, "w+") as f:
|
||||
f.write(results)
|
||||
print("Results written to", filename)
|
||||
@@ -0,0 +1 @@
|
||||
Security/BadPractice/InsecureTemporaryFile/InsecureTemporaryFile.ql
|
||||
@@ -0,0 +1,6 @@
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
def write_results(results):
|
||||
with NamedTemporaryFile(mode="w+", delete=False) as f:
|
||||
f.write(results)
|
||||
print("Results written to", f.name)
|
||||
@@ -0,0 +1 @@
|
||||
semmle-extractor-options: -p ../../lib --max-import-depth=3
|
||||
Reference in New Issue
Block a user